Results of this run
PAM medoids on Customer Segments pick 4 real Customer Segments rows as centers (k=4). Medoid silhouette is 0.397, medoid Calinski-Harabasz is 328.2, medoid Davies-Bouldin is 1.295, medoid inertia is 176.95. Held-out segment matches the medoids at adjusted Rand 0.640. 0 noise rows out of 200 were still assigned. Medoid group 0 on Customer Segments holds 40 rows (annual_income 79677.0 / avg_spend 3094.3). Medoid group 1 on Customer Segments holds 101 rows (annual_income 37642.4 / avg_spend 670.1). Medoid group 2 on Customer Segments holds 49 rows (annual_income 55981.7 / avg_spend 1651.8). Medoid group 3 on Customer Segments holds 10 rows (annual_income 73298.0 / avg_spend 2390.5). Medoid sweep: k 2 reaches 0.602 with 2 groups on Customer Segments; k 3 reaches 0.489 with 3 groups on Customer Segments; k 4 reaches 0.397 with 4 groups on Customer Segments; k 5 reaches 0.297 with 5 groups on Customer Segments; k 6 reaches 0.282 with 6 groups on Customer Segments; k 7 reaches 0.173 with 7 groups on Customer Segments; k 8 reaches 0.180 with 8 groups on Customer Segments. The medoid scatter is PCA at 90.5% variance.

| k | Silhouette | Clusters |
|---|---|---|
| 2 | 0.602 | 2 |
| 3 | 0.489 | 3 |
| 4 | 0.397 | 4 |
| 5 | 0.297 | 5 |
| 6 | 0.282 | 6 |
| 7 | 0.173 | 7 |
| 8 | 0.180 | 8 |
from sklearn.preprocessing import StandardScaler
Xs = StandardScaler().fit_transform(X)
# PAM with k-medoids++ init, euclidean distance, random_state=42, n_clusters=4.
# The sandbox K-Medoids control uses the same seed and scaling.
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.
