K-Means
- Clusters
- A fixed number.
- Center
- A mean.
- Rows
- One cluster each.
Loading…
K-Means assigns each row to the nearest of a fixed number of means. Mean shift chooses its own clusters from a bandwidth. These runs estimate that bandwidth at quantile 0.3 with bin seeding.
Choose whether the cluster count is fixed or follows a bandwidth.
This is a choice, not a measured winner.
K-Means Clustering has the higher silhouette on Wine (UCI wine recognition); Mean Shift Clustering has the higher silhouette on Iris Flowers and Customer Segments.
Do you need a fixed number of clusters?
A chosen count, instead of clusters that follow a bandwidth.
Mean shift on Iris Flowers (150 rows and 4 features) chooses 2 clusters from bandwidth 1.6025, silhouette 0.582, adjusted Rand 0.568, noise rows 0. The groups hold 100 and 50 rows. K-Means uses 3 means on the same scaled rows, silhouette 0.460, adjusted Rand 0.620. The bandwidth modes separate these rows more cleanly than the fixed means.


The link loads the sample. Run is still required.
Mean shift on Wine (UCI wine recognition) (178 rows and 13 features) chooses 2 clusters from bandwidth 4.0933, silhouette 0.224, adjusted Rand -0.006, noise rows 0. The groups hold 174 and 4 rows. K-Means uses 3 means on the same scaled rows, silhouette 0.285, adjusted Rand 0.897. The fixed means separate these rows more cleanly than the bandwidth modes.


The link loads the sample. Run is still required.
Mean shift on Customer Segments (200 rows and 5 features) chooses 2 clusters from bandwidth 1.865, silhouette 0.602, adjusted Rand 0.322, noise rows 0. The groups hold 147 and 53 rows. K-Means uses 4 means on the same scaled rows, silhouette 0.368, adjusted Rand 0.763. The bandwidth modes separate these rows more cleanly than the fixed means.


The link loads the sample. Run is still required.
| Dataset | Algorithm | Clusters | Noise | Silhouette | Adjusted Rand |
|---|---|---|---|---|---|
| Iris Flowers | K-Means Clustering | 3 | 0 | 0.460 | 0.620 |
| Iris Flowers | Mean Shift Clustering | 2 | 0 | 0.582 | 0.568 |
| Wine (UCI wine recognition) | K-Means Clustering | 3 | 0 | 0.285 | 0.897 |
| Wine (UCI wine recognition) | Mean Shift Clustering | 2 | 0 | 0.224 | -0.006 |
| Customer Segments | K-Means Clustering | 4 | 0 | 0.368 | 0.763 |
| Customer Segments | Mean Shift Clustering | 2 | 0 | 0.602 | 0.322 |
K-Means assigns each row to the nearest of a fixed number of means. Mean shift chooses its own clusters from a bandwidth. These runs estimate that bandwidth at quantile 0.3 with bin seeding.
Method: StandardScaler, drop constant columns. Code version 3e4afc4b4352 (scripts/seo/build_explore_artifacts.py). scikit-learn 1.4.2. Seed 42. Both algorithms were fit on the same scaled table. Where a label column exists, it was held out of the fit and scored with adjusted Rand. Iris Flowers: UCI Machine Learning Repository, Iris (Fisher, 1936). License: CC BY 4.0. Wine (UCI wine recognition): UCI Machine Learning Repository, wine recognition. License: CC BY 4.0. Customer Segments: Synthetic customer records bundled with this site. License: Generated for demos; no external license.
Results computed, published, and last updated on 2026-11-02.
The comparison sentences are filled from these published runs by a fixed template, so the scores can be checked against the same datasets in the tool.
Maintainer: nikolaou1982.
Contact: nick1982100@gmail.com.