Results of this run
K-Means centroids on Customer Segments (200 x 5, k=4) land at silhouette 0.368, Calinski-Harabasz 373.8, Davies-Bouldin 1.126, inertia 148.78. Agreement with held-out segment is adjusted Rand 0.763. 0 noise rows out of 200 sit outside a centroid. Centroid group 0 on Customer Segments holds 50 rows (annual_income 78401.2 / avg_spend 2953.6). Centroid group 1 on Customer Segments holds 64 rows (annual_income 31844.3 / avg_spend 699.6). Centroid group 2 on Customer Segments holds 48 rows (annual_income 56102.0 / avg_spend 1659.3). Centroid group 3 on Customer Segments holds 38 rows (annual_income 47738.3 / avg_spend 636.7). K-Means k sweep: k 2 scores 0.602 with 2 groups on Customer Segments; k 3 scores 0.489 with 3 groups on Customer Segments; k 4 scores 0.368 with 4 groups on Customer Segments; k 5 scores 0.359 with 5 groups on Customer Segments; k 6 scores 0.298 with 6 groups on Customer Segments; k 7 scores 0.198 with 7 groups on Customer Segments; k 8 scores 0.193 with 8 groups on Customer Segments. PCA keeps 90.5% for the K-Means scatter.

| k | Silhouette | Clusters |
|---|---|---|
| 2 | 0.602 | 2 |
| 3 | 0.489 | 3 |
| 4 | 0.368 | 4 |
| 5 | 0.359 | 5 |
| 6 | 0.298 | 6 |
| 7 | 0.198 | 7 |
| 8 | 0.193 | 8 |
from sklearn.cluster import KMeans
from sklearn.preprocessing import StandardScaler
Xs = StandardScaler().fit_transform(X)
labels = KMeans(n_clusters=4, n_init=10, random_state=42).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.
