How do you know if your clusters are good? Internal criteria measure cohesion and separation from the data alone. External criteria compare to ground-truth labels. Relative criteria compare different clustering runs.
Internal indices evaluate clustering quality using only the data and the cluster assignments — no ground-truth labels. They quantify two competing goals: cohesion (points within a cluster should be close to each other) and separation (clusters should be far from each other).
Silhouette coefficient: for each point xᵢ, let a(xᵢ) = mean distance to points in its own cluster, and b(xᵢ) = mean distance to points in the nearest other cluster. Then SC(xᵢ) = (b(xᵢ) - a(xᵢ)) / max(a(xᵢ), b(xᵢ)). Range: [-1, 1]. SC near 1 = point is well-matched to its cluster; near 0 = on a boundary; near -1 = probably in the wrong cluster. The mean SC across all points is the overall silhouette score.
External indices compare the clustering result to a known set of true class labels. They answer: does the algorithm recover the natural groupings? These are useful in research when you have labeled data but want to evaluate clustering without using labels during training.
For any pair of points (i, j) you can classify the pair into four categories based on whether the clustering and the ground truth agree:
Relative criteria compare multiple clustering results to find the best K or the best algorithm setting. No ground truth needed — you just run the algorithm many times and compare the internal index scores.
Elbow method: plot SSW vs. K. As K increases, SSW always decreases. The optimal K is at the "elbow" — where the rate of decrease drops sharply. Adding more clusters beyond the elbow gives diminishing returns in cohesion. Combine with silhouette scores to confirm: the silhouette peaks at the same K.
Say the answer out loud before revealing — recalling is what makes it stick. ➜ Next: PyTorch Basics
What do a(xᵢ) and b(xᵢ) represent in the silhouette formula, and what does a high SC indicate?
What do the four categories (a, b, c, d) represent in external cluster validation?
What is the elbow method and how does it help choose K?
Why is Adjusted Rand Index (ARI) preferred over the plain Rand Index for benchmarking?