Mean Shift clustering — move points toward density modes
Mean Shift treats the table as a kernel density and walks every row uphill until it sits on a mode. Rows that arrive at the same mode share a cluster. The number of modes is an outcome of the bandwidth, not an input. A small bandwidth finds many local bumps; a large bandwidth flattens them into one.
On scaled Iris the bandwidth estimated at quantile 0.3 produced 2 modes, silhouette 0.582, adjusted Rand 0.568 against species. The walk merged the overlapping species into one mode and left setosa as the other. There is no noise label: cluster_all assigns every row to some mode, even if the climb was long.
Bandwidth estimation samples the pairwise distances, so two runs with different seeds can pick a slightly different radius on a small table. Fix the seed when you need the published modes to repeat.
Settings that change this fit
- quantile
- Used only to estimate bandwidth. 0.3 is a middle setting. Drop it if genuine modes are being merged; raise it if you are splitting one cloud into specks.
- bin seeding
- Starts the walk from a grid instead of from every row. Same modes on a small CSV, much less work on a large one.