Silhouette score

Also known as: silhouette coefficient

On this page 7

The silhouette score is an internal clustering validation metric that measures how well each data point fits its assigned cluster compared with the nearest neighboring cluster, producing a value between -1 and 1. In model evaluation for artificial intelligence and machine learning, it is one of the most widely used ways to judge an unsupervised clustering result when no ground-truth labels exist.

The metric, also called the silhouette coefficient, was proposed by Peter Rousseeuw in 1987 together with a graphical display known as the silhouette plot. It rewards clusters that are compact internally and well separated from each other, and it is commonly used to compare algorithms, distance measures and candidate numbers of clusters.

How the silhouette score is calculated

The silhouette score is computed per point from two average distances and then averaged over the whole dataset. For a point i, the value a(i) is the mean distance to all other members of its own cluster, which measures cohesion. The value b(i) is the smallest mean distance from i to the members of any other cluster, which measures separation from the nearest alternative.

The point silhouette is s(i) = (b(i) - a(i)) / max(a(i), b(i)). By convention, a point that is alone in its cluster receives a silhouette of zero. The overall silhouette score is the mean of s(i) across all points, although per-cluster means are often reported as well because a single average can hide one poor cluster.

The following table shows how individual silhouette values are usually interpreted.

Silhouette valueMeaning for the pointTypical action
Close to 1Deep inside its own clusterNone needed
Around 0On the boundary between two clustersCheck whether clusters should merge
NegativeCloser to another cluster than its ownLikely misassigned, inspect the point
Close to -1Clearly in the wrong clusterRevisit the algorithm or the number of clusters
Interpreting point silhouette values

The calculation needs only a distance function and the cluster labels. Euclidean distance is the default, but cosine distance is common for text and embedding vectors, and any metric that suits the data can be used, which makes the score applicable well beyond k-means.

Reading the overall score

An overall silhouette score is read on rough bands rather than strict thresholds, because its typical level depends on the data and dimensionality. Rousseeuw’s original guidance remains a practical starting point and is summarized below.

Average silhouetteUsual interpretationCaution
0.71 to 1.00Strong cluster structureVerify that clusters are not trivial outlier groups
0.51 to 0.70Reasonable structureUsually acceptable for segmentation
0.26 to 0.50Weak structure, possibly artificialInspect with plots and domain knowledge
0.25 or lowerNo substantial structure foundClusters may reflect noise or arbitrary cuts
Common rule-of-thumb bands for the average silhouette

These bands are heuristics, not statistical tests. In high-dimensional embedding spaces, distances tend to concentrate, and scores of 0.1 to 0.3 are common even for useful groupings. A score is most informative when used comparatively, for example across different values of k on the same data and with the same distance metric.

Choosing the number of clusters with silhouette analysis

Silhouette analysis selects the number of clusters by fitting the model for a range of k values and choosing the k with the highest average silhouette, subject to a visual check. It is often preferred over the elbow method because it gives a clearer maximum instead of a subjective bend in a curve.

The silhouette plot sorts point values within each cluster and draws them as horizontal bars. Good solutions show clusters of similar thickness whose bars mostly exceed the average line. Thin clusters, many negative bars or one cluster far below average indicate that the chosen k splits or merges natural groups.

  1. Standardize or otherwise scale features so that no single feature dominates the distance.
  2. Fit the clustering model for k from 2 up to a sensible maximum, such as 10 or 15.
  3. Compute the average silhouette and the per-cluster silhouettes for each k.
  4. Shortlist the best values and inspect their silhouette plots before choosing.

How it compares with other clustering metrics

The silhouette score belongs to the family of internal validation indices, which judge clusters from the data alone, unlike external indices that require true labels. The table places it among the metrics a practitioner is most likely to report.

MetricNeeds labelsBetter valueMain strength or weakness
Silhouette scoreNoHigher, up to 1Intuitive per-point view, quadratic cost
Davies-Bouldin indexNoLower, minimum 0Fast, but assumes centroid-based clusters
Calinski-Harabasz indexNoHigher, unboundedFast, favors convex clusters
Adjusted Rand indexYesHigher, up to 1Compares with ground truth, corrects for chance
Normalized mutual informationYesHigher, up to 1Label agreement, less sensitive to cluster count
Silhouette score compared with related clustering metrics

Unlike supervised metrics such as accuracy or the F1 score, none of the internal indices confirm that clusters are meaningful for the business or scientific question. They measure geometric quality only, so reporting two complementary indices plus a qualitative review is a common and sound practice.

Limitations and common mistakes

The silhouette score has a clear bias toward convex, similarly sized clusters, and it can mislead on other shapes. Density-based methods such as DBSCAN may find correct ring-shaped or elongated clusters that nonetheless receive a low silhouette, because the metric compares mean distances rather than connectivity.

PitfallConsequenceBetter practice
Unscaled featuresOne feature dominates distancesStandardize before clustering and scoring
Including noise pointsScore distorted for DBSCAN resultsExclude noise labels or report separately
Full computation on huge dataO(n²) time and memoryScore a random sample of points
Comparing different distance metricsValues are not comparableFix one metric for every candidate
Trusting the average aloneOne bad cluster stays hiddenInspect per-cluster values and plots
Pitfalls when using the silhouette score

Because the full calculation compares every pair of points, datasets above roughly 100,000 samples are usually scored on a representative sample of 10,000 to 50,000 points. Repeating the sample a few times shows whether the estimate is stable enough to support a decision.

The simple explanation

The silhouette score asks every data point a simple question: are you closer to your own group or to the nearest other group? If a point sits comfortably among its own group, it scores near 1. If it sits on the fence, it scores near 0. If it would fit better elsewhere, it scores below 0.

Averaging these answers gives one number for the whole grouping. A high average means the groups are tight and clearly apart, like guests at a party standing in distinct circles. A low average means the circles blur into one crowd, and the grouping may not reflect anything real.

How it is used in practice

A data scientist at a subscription streaming service wants to group about 400,000 customers by viewing behavior to tailor email campaigns. She builds 12 standardized features, such as weekly hours, share of series versus films and late-night viewing, and runs k-means for k from 2 to 10. Silhouette scores are computed on a random sample of 30,000 customers, repeated three times.

The average silhouette peaks at 0.42 for k equal to 5, while k equal to 3 scores 0.39 and k equal to 8 drops to 0.27. The silhouette plot for k equal to 5 shows one thin cluster with many negative values, which turns out to mix weekend binge viewers and occasional users. After removing two noisy features, the score rises to 0.48, and the marketing team receives five clearly distinct segments that it can describe and target.