Key Takeaways: Chapter 20
Clustering: K-Means, DBSCAN, and Hierarchical Clustering
-
There is no "correct" clustering --- only useful ones. Clustering is exploratory, not predictive. There is no target variable, no accuracy score, no confusion matrix. A clustering algorithm will always find clusters, even in random noise. The question is never "Did the algorithm find the right clusters?" but "Do these clusters enable different decisions?" If the marketing team runs different A/B tests per segment and sees different results, the clustering was useful. If every segment gets the same intervention, the clustering was a wasted exercise.
-
K-Means is simple, fast, and wrong about 30% of the time. K-Means assumes spherical clusters with equal variance and roughly equal size. When those assumptions hold, it works beautifully. When they do not --- non-convex shapes, varying density, unequal cluster sizes --- K-Means fails silently. It does not raise an error. It does not warn you. It returns confident labels that happen to be wrong. Always visualize your clusters (in 2D projections if needed) and test whether the assumptions are plausible for your data.
-
Feature scaling is non-negotiable for distance-based clustering. K-Means, DBSCAN, and hierarchical clustering all use distance metrics. If one feature is measured in thousands and another in single digits, the high-magnitude feature dominates and the clustering is effectively one-dimensional. Use StandardScaler before any distance-based clustering. Profile results on the original (unscaled) features for business interpretation.
-
Use three methods together to choose k: elbow, silhouette, and gap statistic. No single method is definitive. The elbow method is visual and often ambiguous. The silhouette score provides a single number but hides per-cluster problems. The gap statistic compares against a null distribution but requires computational overhead. When all three agree, you can be reasonably confident. When they disagree, the data may not have clean clusters, and your choice of k should be driven by business utility.
-
The silhouette plot reveals what the silhouette score hides. The mean silhouette score is a useful summary, but it averages across clusters. The per-cluster silhouette plot shows the distribution of silhouette coefficients within each cluster. Look for clusters where many points have negative silhouette values (wrong cluster assignment), clusters with very thin blades (potential artifacts), and unequal blade widths (imbalanced clusters). This visualization is more informative than any single number for choosing k.
-
DBSCAN finds clusters of arbitrary shape and labels noise --- but it has its own failure modes. DBSCAN does not need k. It can find crescent-shaped, ring-shaped, and other non-convex clusters that K-Means cannot handle. It explicitly identifies noise points, which K-Means cannot do. But DBSCAN struggles with varying-density clusters (a single eps cannot capture both dense and sparse regions), degrades in high dimensions (above ~20 features), and lacks a predict method for new data. Use the k-distance plot to choose eps and consider HDBSCAN when density varies across clusters.
-
Hierarchical clustering produces the best exploratory visualization in unsupervised learning: the dendrogram. The dendrogram shows the complete merging history of clusters at every resolution. Large vertical gaps indicate well-separated clusters. The horizontal cut line lets you explore multiple k values without re-running the algorithm. Use hierarchical clustering on subsamples (it is O(n^2) in memory) for exploratory analysis, and use Ward linkage as a default unless you expect elongated or chain-like clusters.
-
Evaluate clusters on internal metrics, stability, and --- most importantly --- business utility. Internal metrics (silhouette, Calinski-Harabasz, Davies-Bouldin) measure geometric quality: are clusters compact and well-separated? Stability analysis (re-clustering subsamples and comparing via ARI) measures whether the clusters are robust to data perturbation. But the ultimate evaluation is domain expert validation and business impact. Show the cluster profiles to the people who will use them. If they recognize the segments and can propose different actions for each, the clustering is working.
-
Cluster profiling on original features is the deliverable, not the clustering itself. The business does not care about your silhouette score. It cares about profiles: "Segment A spends $2,400/year, visits 12 times/month, and uses no discounts --- these are your loyalists." Always compute means, medians, and distributions of the original (unscaled) features per cluster. Name each cluster with a human-readable label. The profiling table is what goes in the presentation.
-
Clustering complements classification; it does not replace it. The churn model answers "Who will churn?" Clustering answers "What types of subscribers exist?" Together, they answer "Who will churn, and what kind of churner are they?" This combination enables differentiated interventions: billing fixes for the payment-friction segment, content recommendations for the casual-viewer segment, premium offers for the rare at-risk power user. Neither tool alone provides this granularity.
If You Remember One Thing
K-Means will always find clusters --- even in random noise. The algorithm does not know whether your clusters are real. It minimizes inertia and returns labels, regardless of whether the underlying data has any meaningful structure. Your job is not to run the algorithm. Your job is to evaluate whether the result is useful: silhouette analysis to check separation, cluster profiling to check interpretability, stability analysis to check robustness, and domain expert validation to check business relevance. The algorithm is the easy part. The evaluation is the skill.
These takeaways summarize Chapter 20: Clustering. Return to the chapter for full context.