Mean Shift Clustering on Customer Segments

Mean Shift Clustering on Customer Segments produced 2 clusters and 0 noise rows (silhouette 0.602, adjusted Rand 0.322 against held-out segment).

Results of this run

Mean Shift modes on Customer Segments use bandwidth 1.865 (quantile 0.3). Mode-seeking silhouette is 0.602, mode Calinski-Harabasz is 448.5, mode Davies-Bouldin is 0.515. The modes recover held-out segment at adjusted Rand 0.322. 0 noise rows out of 200 remain. Mode 0 on Customer Segments holds 147 rows (annual_income 43247.3 / avg_spend 966.8). Mode 1 on Customer Segments holds 53 rows (annual_income 77503.7 / avg_spend 2909.1). Mean Shift bandwidth check: bandwidth 1.865 returns 0.602 with 2 groups on Customer Segments. Mode plot variance kept: 90.5%.

Mean Shift Clustering on Customer Segments: PCA plot of 2 clusters and 0 noise rows
Each point is one row. Gray points are noise. Computed 2026-11-02 with scikit-learn 1.4.2.
bandwidthSilhouetteClusters
1.8650.6022
from sklearn.cluster import MeanShift, estimate_bandwidth
from sklearn.preprocessing import StandardScaler
Xs = StandardScaler().fit_transform(X)
bandwidth = estimate_bandwidth(Xs, quantile=0.3, random_state=42)
labels = MeanShift(bandwidth=bandwidth, bin_seeding=True, cluster_all=True).fit_predict(Xs)

Who, how, and why

Method: StandardScaler, drop constant columns. Code version 3e4afc4b4352 (scripts/seo/build_explore_artifacts.py). scikit-learn 1.4.2. Seed 42. Dataset source: Synthetic customer records bundled with this site. License: Generated for demos; no external license. The segment column was held out of the fit and used only for the adjusted Rand score.

Results computed on 2026-11-02.

The results paragraph is filled from these numbers by a fixed template in the site code, so the scores can be checked against the same dataset in the tool.

Maintainer: nikolaou1982.

Contact: nick1982100@gmail.com.

How Mean Shift Clustering Works

Mean Shift finds cluster centers by iteratively shifting points toward local density maxima. It discovers the number of clusters automatically.

About the Customer Segments Dataset

200 synthetic customer records with spending, income, and loyalty data. Perfect for market segmentation with clustering. Source: Synthetic customer records bundled with this site. License: Generated for demos; no external license.

Samples. 200

Features. 5

Type. Numeric

Category. Density-based

When to Use Mean Shift Clustering

Mean Shift Clustering belongs to the Density-based family of clustering algorithms. These methods identify clusters as regions of high point density separated by regions of low density. They can discover clusters of arbitrary shape.

Related Examples

Ready to try Mean Shift Clustering on your own data?

Upload a CSV and get instant results — free to start.