Quant Memo
Core

Silhouette and Cluster Validity Indices

Cluster validity indices like the silhouette score give a numeric answer to "did clustering actually find real structure, and how many clusters should there be?" when there are no labels to check against.

Clustering has no ground-truth labels to score against, so cluster validity indices exist to answer "is this a good clustering?" using only the data and the assignments themselves. The most common one, the silhouette score, measures for each point how much closer it sits to its own cluster than to the nearest rival cluster.

The silhouette score for a point compares its average distance to points in its own cluster against its average distance to points in the nearest other cluster; scores near +1 mean tight, well-separated clusters, near 0 mean the point sits on a boundary, and negative scores mean it was probably assigned to the wrong cluster.

How it's used

Because the silhouette score doesn't need to know the "correct" number of clusters in advance, it's commonly used to choose k in k-means: run the algorithm for k = 2, 3, 4, … and pick the k with the highest average silhouette score across all points, rather than relying on an arbitrary guess or the elbow method alone.

Worked example

A point sits in a cluster where its average distance to the other 9 members is 2.0 (call this aa), and its average distance to the nearest neighboring cluster is 5.0 (call this bb). The silhouette score is (ba)/max(a,b)=(5.02.0)/5.0=0.6(b - a) / \max(a, b) = (5.0 - 2.0) / 5.0 = 0.6, a solidly positive score indicating the point is well-placed. Averaging this across every point and every candidate value of kk gives a simple way to compare, say, k=3k=3 against k=5k=5 on the same dataset without any labels at all.

A high average silhouette score confirms clusters are well-separated in the geometry you measured, not that they are meaningful — features on very different scales, or a poor choice of distance metric, can produce clean-looking clusters that don't correspond to anything real.

Related concepts

Practice in interviews

Further reading

  • Rousseeuw, 'Silhouettes: A Graphical Aid to the Interpretation and Validation of Cluster Analysis'
ShareTwitterLinkedIn