Clustering Taxonomy
Partitional vs hierarchical vs density-based, no ground truth = no accuracy
You have 10 million user sessions on an e-commerce site. You want to segment users into behavioral types to personalize recommendations. Nobody labeled anything — no one told you "this is a bargain hunter, this is a researcher, this is an impulse buyer." You need to find structure in the data itself. This is unsupervised learning: discovering pattern without a target variable.
The hard part is not the algorithm — it is that without labels, you cannot measure "correct." Every clustering algorithm embeds an assumption about what good clusters look like. K-means assumes spherical clusters of equal size. DBSCAN assumes density-separated clusters. Hierarchical methods assume nested structure. Choosing the algorithm is choosing an assumption, and the right assumption depends on your data geometry. Apply the wrong one and you get confident, stable, wrong clusters.
Evaluation without labels uses three internal metrics. Silhouette score: (b - a) / max(a, b) where a = mean distance to same-cluster points, b = mean distance to nearest different-cluster points. Range [-1, 1], higher is better — but biased toward spherical clusters. Davies-Bouldin index: ratio of within-cluster scatter to between-cluster distance, lower is better. Calinski-Harabasz index: ratio of between-cluster to within-cluster dispersion, higher is better. None of these is a substitute for domain evaluation. A silhouette score of 0.7 on clusters that mix bargain hunters with power users is useless.
Two other failure modes compound as the data or K get large. The curse of dimensionality: as feature count grows, distances between points become statistically similar — with 512 features, the gap between the nearest and farthest neighbor distance shrinks, so "nearest centroid" becomes a nearly arbitrary label. Init sensitivity: K-means starts from randomly placed centroids and only guarantees convergence to a local optimum, not the global one — different random initializations can land on different final clusters, and with a large K (say 150) relative to a modest sample size (10,000 points, about 67 points per cluster on average), those clusters are small enough that which points land where becomes unstable from run to run.
The metric that matters is business validity: pull 20 random examples from each cluster and ask "does this make sense?" Can your recommendation team write a distinct strategy for each segment? If not, the clustering has not solved the problem regardless of what any internal metric says.
NOT-this: "Clustering finds the true segments in your data." Clustering finds segments consistent with the algorithm's assumptions. The "true segments" only exist if your domain actually has discrete groups, not a continuous distribution. Most behavioral data is continuous — clustering imposes discretization. Use clustering to generate hypotheses, not to discover ground truth.
Key points
- Always evaluate clusters qualitatively — look at 20 random examples from each cluster and ask whether the segment makes business sense. Internal metrics (silhouette, Davies-Bouldin) measure geometric quality, not business utility. A cluster with silhouette score 0.7 that mixes bargain hunters with power users is useless. Geometric quality and business utility are independent — you need both.
- Trap: treating the number of clusters K as a hyperparameter to optimize numerically. K is a business decision: "How many user segments can our recommendation system actually serve distinctly?" Start from that constraint, then use the elbow method to verify feasibility — plot within-cluster sum of squares (WCSS) against K; WCSS drops fast at first and then flattens, and the "elbow" is the K where the drop visibly bends from steep to shallow, marking the point where adding more clusters stops buying much tighter fit. Optimizing K on the silhouette score alone divorces the clustering from its purpose.
- Diagnostic: if silhouette scores are near 0 for all K values you try, your data does not have cluster structure under that algorithm's geometry. Try a different algorithm — DBSCAN for density-based structure — or transform the feature space. Near-zero silhouette across all K is a signal about the data and the algorithm's fit to it, not just a bad hyperparameter choice.
Choosing a clustering algorithm is choosing an assumption about what "similar" means — and the algorithm will always produce confident groups regardless of whether those groups reflect real structure or just its geometric constraints.
Recap
- No labels = no accuracy: clustering finds structure, cannot measure "correct."
- Choosing the algorithm = choosing an assumption: K-means spherical, DBSCAN density-separated, hierarchical nested.
- Wrong assumption → confident, stable, wrong clusters.
- Internal metrics (silhouette, Davies-Bouldin, Calinski-Harabasz) measure geometry, not business utility.
- Real test = business validity: pull 20 per cluster, ask "does this make sense?"
- K is a business decision, not a metric to optimize.
- Near-zero silhouette across all K = no cluster structure under that geometry.
- Next up: each family gets its own deep-dive — K-Means Clustering, DBSCAN, and Hierarchical Clustering modules follow this one.
Check your understanding
Q1. A clustering of customers produces 5 clusters with silhouette score=0.62. A domain expert says 3 of the clusters look identical in terms of purchasing behaviour. How do you reconcile this?
- A) Trust the silhouette score — 0.62 is strong evidence the 5 clusters are genuinely distinct, so the expert is likely mistaken here after all
- B) Re-run the clustering with a different random seed and check whether the expert observation persists across multiple runs
- C) Silhouette measures geometric separation, not semantic similarity — revisit feature selection, not noise dimensions
- D) Increase k to 8 so the similar clusters subdivide further, forcing more geometric separation between the resulting sub-groups
Q2. Which two of the following are true when comparing k-means (silhouette=0.71) against DBSCAN (silhouette=0.43) on the same dataset?
- A) Silhouette is biased toward convex, spherical clusters, so a lower DBSCAN score does not necessarily mean the clustering is worse
- B) DBSCAN can score lower yet still be correctly recovering non-convex, density-based structure that k-means cannot represent at all
- C) A higher silhouette score always means objectively better clustering quality, independent of the true cluster shapes present
- D) k-means always produces more stable clusters than DBSCAN because its centroid updates are fully deterministic across seeds
Q3. A colleague proposes using k-means with k=150 to cluster 10,000 user-behaviour vectors with 512 features. What are the failure modes?
- A) The only real problem is runtime — k=150 will be slow to converge but will still produce valid, meaningful clusters once it finishes fully
- B) k-means cannot handle more than 100 clusters on any dataset — sklearn silently caps k at 100 during centroid initialisation
- C) Mini-batch k-means should be used instead of full-batch k-means, which resolves all three problems automatically and for free
- D) Three compounding problems: curse of dimensionality at 512 features, k=150 gives unstable micro-clusters of ~67 points, init sensitivity
Q4. You need to explain to a non-technical stakeholder why you cannot report "clustering accuracy." What do you say?
- A) Accuracy can be computed, but it requires running the clustering several times to average results across different random seeds used
- B) Accuracy needs known correct labels for comparison — clustering is unsupervised, so report silhouette score and business validation
- C) Accuracy is technically computable but misleading here, so instead we report WCSS as the primary quality metric to stakeholders
- D) Accuracy requires at least 10,000 samples to be meaningful; below that threshold, only the silhouette score is considered valid
Try it interactively
ML Systems Lab is a free interview-prep platform for ML engineers — work through the full interactive module, quizzes, and drills.
Open ML Systems Lab →