Notes

Silhouette Score

When you cluster data, the hard part is not just forming groups—it is judging whether those groups actually make sense. Silhouette Score gives you a simple way to ask: is each point closer to its own cluster than to neighboring clusters?

How it works

For each data point, the silhouette value compares two distances:

  • a: the average distance from that point to other points in its own cluster
  • b: the average distance from that point to points in the nearest different cluster

The score is computed as (b - a) / max(a, b), which puts it between -1 and 1. A value near 1 means the point fits well inside its cluster and is far from others. A value near 0 means it sits on a boundary. A negative value means it may have been assigned to the wrong cluster. The overall Silhouette Score is the average across all points.

Why it matters

In unsupervised learning, you usually do not have true labels, so internal checks like this are essential. The silhouette score helps compare clustering results from methods like K-Means, agglomerative clustering, or spectral clustering, and it is widely used to choose the number of clusters k. In customer segmentation, for example, a higher score suggests the customer groups are more distinct and internally consistent. In document clustering or image grouping, it helps reveal whether the model found real structure or just forced the data into arbitrary partitions.

Limits and practical use

The metric works best when clusters are fairly compact and well separated. It can be misleading for irregular shapes, varying densities, or algorithms like DBSCAN that discover non-spherical clusters. It also depends on the chosen distance metric, such as Euclidean or cosine distance. In practice, people often compute it with scikit-learn’s silhouette_score and inspect both the average score and a silhouette plot, because the plot shows whether some clusters are strong while others are messy.

Silhouette Score is an internal clustering metric that measures how well each data point fits its assigned cluster compared with the nearest alternative cluster. It combines cluster cohesion and cluster separation into a value from -1 to 1, where higher scores indicate better-defined clusters. It matters because it helps compare clustering results and choose the number of clusters without requiring ground-truth labels.

Imagine sorting a box of mixed buttons into piles. A good sort means buttons in the same pile look very similar, and each pile looks clearly different from the others. Silhouette Score is a way to judge how good that sorting is.

In AI, it’s used when a system groups data into clusters without being told the “right” answers first. The score asks two simple questions: does each item fit well with its own group, and does it stay far from other groups? A higher Silhouette Score means the groups are tighter and more clearly separated. That makes it useful for checking whether the AI’s grouping actually makes sense.