You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Verify STUDY k-means canonicalization does not shift cluster numberingΒ #389
π€ Filed by an agent at @adelorme's request, as post-merge follow-up for the EEGLAB test-port stack (#329β#372).
studyfunc/_cluster_kmeans.py (+10 / β39) replaced its local multi-restart k-means with a call to miscfunc.kmeans_st._kmeans_labels. The two share RNG (np.random.default_rng(random_state)), rng.choice initialization, iteration structure, KMEANS_TOLERANCE, and inertia-based restart selection, so most behavior should be identical. Two differences remain:
_kmeans_labels recomputes labelsafter the final center update; the removed code returned labels matched to the pre-update centers. Points near a cluster boundary can change assignment.
_kmeans_labels returns _canonicalize_clusters(best_labels, best_centers), imposing a canonical cluster ordering where the removed code returned RNG-dependent ordering. Cluster numbering may therefore change.
STUDY cluster numbers are user-visible and are referenced in saved designs, so a renumbering is a user-facing change even when membership is unchanged.
This path is not covered by the parity_repo pipeline (no STUDY stage), so the parity run does not speak to it.
Ask: confirm both changes are intended, and check cluster numbering + membership stability on sample_data/ before and after.
Activity