- Introduced by
- Peter Rousseeuw
- Year
- 1987
- Type
- Cluster quality metric
- Family
- Clustering Validation
What does it do?
The Silhouette Coefficient, introduced by Peter Rousseeuw in 1987, measures for each object how similar it is to its own cluster compared with the nearest other cluster.
Scores range from -1 to 1: values near 1 indicate compact, well-separated placement, values near 0 indicate objects lying between clusters, and negative values indicate objects that sit closer to another cluster than to their own. It assesses a clustering without requiring external labels.
The intuition behind the method
A good cluster is compact (its members lie close together) and separated (other clusters lie far away). For each point, the silhouette compares its average distance to the other members of its own cluster with its average distance to the nearest neighbouring cluster. If the point is much closer to its own group, the score is high and positive. If it is about as close to a rival group, the score is near zero, and if it is closer to a rival group, the score is negative. The average over all points gives an overall assessment of the partition.
History
Peter Rousseeuw introduced the silhouette in 1987 in a paper titled 'Silhouettes: a graphical aid to the interpretation and validation of cluster analysis', published in the Journal of Computational and Applied Mathematics. The title reflects its graphical use: per-point silhouette plots show each object's score grouped by cluster. The index was proposed for validating clusterings without external labels. It has since been used widely in clustering practice and appears among the standard internal validation measures in textbooks.
When to use it
Choose the silhouette when there are no ground-truth labels and you need to judge whether a partition is internally coherent, for example to compare clusterings of the same data or to compare candidate numbers of clusters. The score requires at least two clusters and fewer clusters than samples (2 ≤ k ≤ n−1). With a single cluster, b(i) is undefined, and the coefficient is only meaningful when the number of predicted labels is less than the number of samples clustered. It fits partitions whose clusters are roughly compact and convex. Avoid relying on it alone when clusters are elongated, irregular or of very different density, because the mean-distance structure of the score favours compact groups. If reference labels exist, an external agreement index such as adjusted-rand-index answers a different question and is more appropriate for comparing with known groupings.
Limitations and considerations
- Because a(i) and b(i) are mean distances to whole clusters, compact convex groups tend to score highest; elongated or irregular clusters are penalised even when they are correctly recovered.
- Clusters of very different density or size can lower scores for legitimate groups, since the mean distance to a sparse cluster is large relative to its neighbours.
- An outlying point assigned to a cluster adds a large distance to the averages of every member of that cluster. This lowers their scores and can make the overall average look worse than the rest of the partition warrants, so inspect per-point values before drawing conclusions.
- Computing the score requires all pairwise distances, so the computational cost grows quadratically with the number of points.
- The score describes the geometry of the partition. A high value shows internal coherence, not that the clusters correspond to any real underlying grouping.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- The score is bounded between -1 and 1, and its sign has a direct meaning: a negative value means the point is, on average, nearer to another cluster than to its own.
- It uses only pairwise distances, not labels or a fitted model, so it can be computed from any dissimilarity defined between points. The values are interpretable, however, only if that dissimilarity reflects the structure of the data.
- It gives both an overall average and a per-point score, so individual poorly placed observations can be located as well as the partition judged as a whole.
Applications
- Choosing the number of clusters by computing the average silhouette for several candidate values of k within 2 ≤ k ≤ n−1 and comparing them, as described in the FAQ.
- Inspecting per-point silhouette plots to find individual observations that lie between clusters or appear to be assigned to the wrong one before accepting a partition.
- Comparing partitions of the same dataset produced by different algorithms, provided all of them are scored under the same distance metric and feature scaling. If the metric changes, rescore every partition under one common metric before comparing.
- Screening unlabelled clustering output, where no reference groups exist, so that low-scoring points can be flagged for manual review.
How it works
How it works
For each point, compute the mean distance from that point to the members of every cluster. For the point's own cluster, average only over the other members and leave out the point itself, because its zero distance to itself would bias the mean downward. These mean distances are the inputs to the two quantities below.
Formula
d(i, C) = \frac{1}{|C|} \sum_{j \in C} ||x_i - x_j||a(i) is the average distance from point i to the other points in its own cluster. It measures how tightly the point sits within its group. A point alone in its cluster has no within-cluster distance, so implementations need a convention for it; common ones assign such a point a score of zero.
Formula
a(i) = \text{distance of } x_i \text{ to its own cluster}b(i) is the smallest of the mean distances from point i to the other clusters, that is, its distance to the nearest neighbouring cluster. It measures how far the point is from the closest alternative group.
Formula
b(i) = \min_{C' \neq C} d(i, C')s(i) = (b(i) - a(i)) / max(a(i), b(i)). The numerator is positive when the point is closer to its own cluster than to the nearest rival, and negative otherwise. Dividing by the larger of the two distances keeps s(i) between -1 and 1 by construction. The overall score is the mean of s(i) over all points.
Formula
s(i) = \frac{b(i) - a(i)}{\max(a(i), b(i))}Common pitfalls
- Reading only the average: an acceptable overall value can hide one cluster in which many points have negative scores. Check per-cluster and per-point values before accepting the partition.
- Treating a high average as evidence of meaningful clusters when the true structure is non-spherical; the score can favour a compact split over the correct one.
- Changing the distance metric or the feature scaling and then comparing silhouette values across runs as though they were on the same footing, since the distances that define the score have changed.
- Using the silhouette as the only check, without visual inspection of the per-point plot or validation against domain knowledge.
Frequently asked questions
What does a negative silhouette coefficient mean?
A negative coefficient for a point indicates that the point is, on average, closer to the nearest other cluster than to its assigned cluster. This suggests potential misclassification and that the point might belong to a different cluster or be an outlier.
How do I interpret the overall silhouette score for my clustering?
Higher average values mean tighter, better-separated groups, and values near zero mean many points lie between clusters. No universal cut-off separates good from poor clusterings, so judge the value against the alternatives you compared, the per-point plot and the nature of your data, and combine it with other validation measures.
Does silhouette score require labeled data?
No; silhouette is an unsupervised metric. It evaluates cluster quality based on the clustering assignment itself, not external labels. This makes it useful when ground truth is unavailable.
Can I use silhouette score to choose the optimal number of clusters?
Yes, within the range 2 ≤ k ≤ n−1: compute the average silhouette score for each candidate number of clusters and select the k that maximizes the score. A single-cluster solution cannot be scored. Combine the result with domain knowledge and other validation metrics when choosing the number of clusters.
Related methods
Sources
Rousseeuw, P. J. (1987). Silhouettes: a graphical aid to the interpretation and validation of cluster analysis. Journal of Computational and Applied Mathematics, 20, 53-65.
Open DOI reference