intermediateadvanced-ml

Clustering Evaluation & Silhouette Score

There are no labels to check against, so how do you know if your clusters are actually good?

Key Points

What it is

Since clustering is unsupervised, there's no ground truth to compute accuracy against. The silhouette score measures how similar each point is to its own cluster compared to the next closest cluster, giving a single number between -1 and 1 that reflects how well-separated and cohesive the clusters are.

Why it exists

Without labels, it's tempting to just eyeball a 2D plot and declare clusters 'good,' which doesn't scale past two or three dimensions and is unreliable. Silhouette score and related metrics exist to give clustering a quantitative, repeatable way to compare different choices of k or different algorithms.

Intuition

For any point, ask two questions: 'How close am I to the other points in my own cluster?' and 'How close am I to the points in the nearest other cluster?' A good cluster member is much closer to their own group than to any other group — that gap is what the silhouette score captures, averaged across every point.

Formulas

Silhouette Score for one point

s(i)=b(i)−a(i)max⁡(a(i),b(i))s(i) = \frac{b(i) - a(i)}{\max(a(i), b(i))}
  • a(i) — Average distance from point i to other points in its own cluster
  • b(i) — Average distance from point i to points in the nearest neighboring cluster
  • s(i) — Silhouette value for point i, ranging from -1 to 1

When to use

When not to use

Common mistakes

In practice

Standard step after any K-Means or hierarchical clustering run — used to justify the chosen number of clusters and to catch cases where clusters are poorly separated before presenting results.

Was this concept helpful?

Spot an error or gap? Suggest an edit →

Related concepts

k-means-clusteringhierarchical-clusteringdbscan
Chirp at me!