Citation and evidence

Silhouette score

14 min full readUpdated 19 references

This article's verification

Report a problem with this article

Edit article
More

Use this article

Raw MarkdownExplore connections

Improve this page

Revision historyDiscuss this article

Topics

Machine LearningModel EvaluationStatistics

Cite this article

The silhouette score (also called the silhouette coefficient, or the average silhouette width) is an internal measure of clustering quality that compares, for each data point, how close the point is to the other members of its own cluster with how close it is to the nearest other cluster. Each point receives a silhouette value between -1 and 1, and the mean over all points summarizes a whole partition in a single number. Peter J. Rousseeuw introduced silhouettes in 1987 as a graphical display for partitioning methods, proposing the average silhouette width as an evaluation of clustering validity and as a way to choose an appropriate number of clusters [1]. Because it needs only the cluster labels and the pairwise dissimilarities, and no ground-truth classes, the silhouette is widely used to compare clusterings and to pick kk for algorithms such as k-means and k-medoids [2][3][8].

Definition

Let a dataset be divided into kk clusters and let d(i,j)d(i, j) be the dissimilarity (often a distance) between objects ii and jj. For an object ii assigned to cluster AA, the quantities below follow the notation of Struyf, Hubert and Rousseeuw (1997) [2]:

  • a(i)a(i) is the average dissimilarity of ii to all other objects of AA:
a(i)=1∣A∣−1∑j∈A, j≠id(i,j)a(i) = \frac{1}{|A| - 1} \sum_{j \in A,\, j \neq i} d(i, j)
  • For every other cluster C≠AC \neq A, d(i,C)d(i, C) is the average dissimilarity of ii to all objects of CC, and b(i)b(i) is the smallest of these:
b(i)=min⁡C≠A1∣C∣∑j∈Cd(i,j)b(i) = \min_{C \neq A} \frac{1}{|C|} \sum_{j \in C} d(i, j)

The cluster BB that attains this minimum is called the neighbor of ii, its second-best cluster [2]. The silhouette value of ii is then

s(i)=b(i)−a(i)max⁡{a(i),b(i)}s(i) = \frac{b(i) - a(i)}{\max\{a(i), b(i)\}}

which always lies between -1 and 1 [2]. The overall score is the mean of s(i)s(i) over all nn objects, called the average silhouette width (ASW) [2][9]:

sˉ=1n∑i=1ns(i)\bar{s} = \frac{1}{n} \sum_{i=1}^{n} s(i)

The silhouette is only defined when the number of clusters kk satisfies 2≤k≤n−12 \le k \le n - 1 [3][6]. If an object is the only member of its cluster, a(i)a(i) cannot be computed; the R cluster package and Batool and Hennig set s(i)=0s(i) = 0 in that case [6][8], and scikit-learn's implementation also returns 0 for points in clusters of size one [17]. MATLAB's silhouette function instead sets the value of such a point to 1 [7], so averages that include singleton clusters can differ between software packages.

Interpretation of individual values

Value of s(i)s(i)Meaning
Close to 1Object ii is well classified: it is much closer to its own cluster than to the neighbor cluster
Close to 0Object ii lies between two clusters (a(i)≈b(i)a(i) \approx b(i))
Close to -1Object ii is badly classified: it is closer to the neighbor cluster than to its own

Expanded article table

These readings follow Struyf, Hubert and Rousseeuw [2]; scikit-learn's documentation states the same range, adds that values near 0 indicate overlapping clusters, and says negative values generally indicate that a sample has been assigned to the wrong cluster [3]. A negative value is possible only when b(i)<a(i)b(i) < a(i), that is, when some other cluster is on average closer to the point than its own cluster [9].

Worked example

Take five points on a line, {1,2,3}\{1, 2, 3\} in cluster A and {8,9}\{8, 9\} in cluster B, with absolute difference as the distance. For the point 3, the average distance to the other members of A is a=(2+1)/2=1.5a = (2 + 1)/2 = 1.5 and the average distance to B is b=(5+6)/2=5.5b = (5 + 6)/2 = 5.5, so s=(5.5−1.5)/5.5≈0.73s = (5.5 - 1.5)/5.5 \approx 0.73. Repeating the calculation for the other four points gives values of 0.80, 0.85, 0.83 and 0.86, and the average silhouette width of the partition is about 0.81. The point 3, which sits nearest to the other cluster, has the lowest value.

"Silhouette Score, Inliers, and Outliers", video from Orange Data Mining, published August 21, 2023. Watch on YouTube.

History

Rousseeuw's paper "Silhouettes: A graphical aid to the interpretation and validation of cluster analysis" appeared in the Journal of Computational and Applied Mathematics in 1987 [1]. Its abstract describes a display in which each cluster is represented by a silhouette based on a comparison of its tightness and separation, showing which objects lie well inside their cluster and which lie somewhere between clusters; the silhouettes of all clusters are combined into one plot that allows the relative quality of the clusters to be compared [1]. According to Batool and Hennig, the original paper also mentions, in a side remark, the possibility of optimizing the measure to find a clustering [8]. As of November 2026, Crossref lists more than 19,000 works citing the paper [16].

The silhouette was designed together with Partitioning Around Medoids (PAM), the k-medoids method of Kaufman and Rousseeuw [9]. It was built into the clustering programs described in their 1990 book Finding Groups in Data, which were originally stand-alone Fortran programs and were later ported to S-PLUS by Struyf, Hubert and Rousseeuw [2]. Those functions survive in the R cluster package, which CRAN describes as much extended from the original by Rousseeuw, Struyf and Hubert and based on Kaufman and Rousseeuw (1990) [19]; its silhouette() function computes the per-object widths for any partition and cites Rousseeuw (1987) and chapter 2 of Kaufman and Rousseeuw (1990) [6].

Silhouette plots

Silhouette bands for four groups appear to the left of a scatterplot colored by cluster.
Silhouette values for a four-cluster k-means fit appear beside the corresponding synthetic data. The dashed line marks the mean across samples. The scikit-learn developers. BSD 3-Clause License. © 2007-2026 The scikit-learn developers.

The silhouette of a single cluster is a plot of all its s(i)s(i) values ranked in decreasing order, and the full silhouette plot stacks the silhouettes of all clusters so their quality can be compared: a wide silhouette is better than a narrow one [2]. In the example given by Struyf, Hubert and Rousseeuw, a two-cluster PAM partition of 12 European countries (described by gross national product per capita and the percentage of the population employed in agriculture) had an average silhouette width of 0.63; the medoids Portugal and Germany had high values, while Spain, a boundary case, had a low one [2].

The thickness of each band also shows cluster size. In a scikit-learn example on synthetic data, the plot for a two-cluster solution shows one much thicker band because three underlying sub-clusters were merged into it, while a four-cluster solution produces bands of similar thickness [5]. Lenssen and Schubert note that visually inspecting the silhouette plot is feasible only for small datasets, which is one reason the values are usually aggregated into the single ASW statistic [9].

Choosing the number of clusters

The most common use of the silhouette is to choose the number of clusters. Struyf, Hubert and Rousseeuw proposed running PAM several times with different values of kk and selecting the kk that gives the highest average silhouette width; that maximum over kk is what they called the silhouette coefficient (SC) [2]. They gave a subjective interpretation of SC, based on experience, which they said does not depend on the number of objects [2]:

Silhouette coefficientProposed interpretation [2]
0.71 to 1.00A strong structure has been found
0.51 to 0.70A reasonable structure has been found
0.26 to 0.50The structure is weak and could be artificial; try additional methods
0.25 or lessNo substantial structure has been found

Expanded article table

On the 75-point Ruspini dataset, for instance, PAM with four clusters found the four natural groups and gave an average silhouette width of 0.74, compared with 0.63 for three clusters and 0.71 for five, so the four-cluster partition was preferred [2].

The highest average is not always the whole story. scikit-learn's k-means silhouette example reports these averages on synthetic data [5]:

Number of clustersAverage silhouette score [5]
20.705
30.588
40.651
50.561
60.486

Expanded article table

Although two clusters score highest, the example's text calls 3, 5 and 6 bad choices because they produce clusters with below-average silhouette values and widely varying silhouette sizes, and describes the analysis as ambivalent between 2 and 4 [5]. Batool and Hennig found the same tendency more generally: used to estimate kk, the ASW can be tempted to choose too low a kk if that allows very large distances between neighboring clusters, hiding structure that is still meaningful. They advise also considering local optima of the ASW over kk when the global optimum is at k=2k = 2 or another very low value [8].

Properties

  • Distance-based. The measure depends only on the cluster labels and the dissimilarities, so it works with any dissimilarity, including non-Euclidean ones, and is not tied to a particular clustering algorithm [2][8]. In Kaufman and Rousseeuw's book it was suggested for finding the number of clusters with PAM, but Batool and Hennig note that its definition is not directly connected to any specific partitioning method [8].
  • Bounded and scale-free. Values lie in [−1,1][-1, 1] [2]. Batool and Hennig showed that the ASW satisfies the axioms for clustering quality measures proposed by Ackerman and Ben-David, one of which is scale invariance [8][9].
  • Empirical performance. Batool and Hennig report that the ASW achieved overall very good results in the comparison of 30 cluster validity indices by Arbelaitz and colleagues [8][11], and Lenssen and Schubert describe it as performing very well in empirical studies [9].

Limitations

  • Bias toward convex clusters. scikit-learn's documentation states that the silhouette coefficient is generally higher for convex clusters than for other kinds of clusters, such as the density-based clusters produced by DBSCAN [4]. The same caveat appears for the Calinski-Harabasz and Davies-Bouldin indices [4].
  • Preference for few, well-separated clusters. As noted above, the ASW can favor a low kk when merging groups makes the remaining clusters far apart [8].
  • Quadratic cost. Exact computation needs all pairwise dissimilarities, which takes O(N2)O(N^2) time, far more than popular clustering algorithms such as k-means [9]. Sarpe and colleagues put the cost at Θ(n2)\Theta(n^2) distance calculations under general metrics [14].
  • Cluster imbalance. Pavlopoulos, Vardakas and Likas argue that the usual average over all points (micro-averaging) is sensitive to cluster imbalance and can mislead when clusters differ greatly in size [15].
  • Unknown attainable maximum. Sträng and Dinh point out that the dataset-specific maximum of the ASW is usually unknown and that the nominal upper limit of 1 is rarely attainable [18].

Variants

Simplified and medoid silhouette

For center-based methods such as k-means and k-medoids, the average distances can be replaced by the distance to the cluster center or medoid. This "simplified silhouette", which Van der Laan, Pollard and Bryan called the medoid-based silhouette, can be computed in O(Nk)O(Nk) time [9]. When every point is assigned to its closest center, the value reduces further to the medoid silhouette,

s~(i)=1−d1(i)d2(i)\tilde{s}(i) = 1 - \frac{d_1(i)}{d_2(i)}

where d1(i)d_1(i) and d2(i)d_2(i) are the distances from point ii to its closest and second-closest center, and the average medoid silhouette (AMS) is the mean of these values [9]. Lenssen and Schubert proved that the AMS satisfies adapted versions of the clustering-quality axioms [9].

Clustering by optimizing the silhouette

Instead of only scoring clusterings, the silhouette can serve as the objective of a clustering algorithm. Van der Laan, Pollard and Bryan modified PAM's swap step to maximize the ASW directly (PAMSIL), and also proposed a variant that maximizes the medoid silhouette (PAMMEDSIL) [9]. Because PAMSIL recomputes the full silhouette for every candidate swap, each iteration costs O(k(N−k)N2)O(k(N-k)N^2) [9]. Batool and Hennig proposed the OSil algorithm and a faster version based on subsetting, FOSil, for optimum-ASW clustering; in their simulations OSil was the strongest method for data containing clearly separated clusters with differing spreads and sizes [8]. Lenssen and Schubert combined PAMMEDSIL with the FasterPAM improvements to PAM, reporting a 10,464-fold speedup over the original PAMMEDSIL on real data with 30,000 samples and k=100k = 100 [9]; a 2024 journal version adds a variant that chooses the number of clusters directly [10].

Macro-averaged silhouette

Rather than averaging the point values directly, one can average them within each cluster first and then average the cluster means. Pavlopoulos, Vardakas and Likas call this macro-averaging and report it to be far more robust to cluster imbalance than the usual micro-average. They also found that uniform subsampling, the only sampling option in the libraries they examined, undermines that robustness, and proposed sampling per cluster instead [15]. Sträng and Dinh extended their ASW upper bound to the macro-averaged silhouette [18].

Scalable approximations

Several methods address the quadratic cost. Gaido described an algorithm that computes the silhouette with linear complexity in the dataset size for two distance measures, squared Euclidean and cosine, and contributed it to the Apache Spark ML library; the approach does not extend to ordinary Euclidean distance, because the square root prevents the cluster-level statistics from being aggregated [12]. Spark's ClusteringEvaluator, added in version 2.3.0, computes the silhouette using squared Euclidean distance by default, with cosine distance as the alternative [13]. Sarpe, Altieri, Pietracaprina, Pucci and Vandin proposed sampling-based estimators with provable error guarantees, using O(nkε−2ln⁡(nk/δ))O(nk\varepsilon^{-2}\ln(nk/\delta)) distance computations to estimate both individual and global silhouettes within additive error O(ε)O(\varepsilon) with probability at least 1−δ1 - \delta, together with MapReduce and massively parallel designs [14].

Software implementations

SoftwareFunctionNotes
scikit-learn (Python)silhouette_score, silhouette_samplesMean and per-sample values; Euclidean distance by default, any pairwise_distances metric or a precomputed matrix; optional sample_size to score a random subset [3]
R cluster packagesilhouette()Per-object widths, neighbor cluster and summaries for any partition; hierarchical clusterings via cutree() [6]
MATLABsilhouetteSilhouette plot and values; squared Euclidean distance by default; singleton points set to 1 [7]
Apache Spark MLClusteringEvaluatorSquared Euclidean (default) or cosine distance, linear-time algorithm [12][13]

Expanded article table

As of November 2026, scikit-learn's documentation (version 1.9.1) describes silhouette_score as returning the mean silhouette coefficient over all samples, with 1 as the best value and -1 as the worst [3]. Its user guide groups the silhouette coefficient with the Calinski-Harabasz and Davies-Bouldin indices as measures for use when the ground-truth labels are not known, so that evaluation must be performed using the model itself [4].

Continue reading

More from See also

More to read

Topics:Machine LearningModel EvaluationStatistics

References

  1. ^1 ^2 ^3Rousseeuw, Peter J. "Silhouettes: A graphical aid to the interpretation and validation of cluster analysis". Journal of Computational and Applied Mathematics, vol. 20, pp. 53-65, November 1987. doi.org/...0377-0427(87)90125-7
  2. ^1 ^2 ^3 ^4 ^5 ^6 ^7 ^8 ^9 ^10 ^11 ^12 ^13 ^14 ^15Struyf, Anja; Hubert, Mia; Rousseeuw, Peter J. "Clustering in an Object-Oriented Environment". Journal of Statistical Software, vol. 1, no. 4, 1997. doi.org/...jss.v001.i04
  3. ^1 ^2 ^3 ^4 ^5scikit-learn developers. "silhouette_score". scikit-learn 1.9.1 documentation, accessed November 2026. scikit-learn.org/...sklearn.metrics.silhouette_score
  4. ^1 ^2 ^3scikit-learn developers. "Clustering: Clustering performance evaluation (Silhouette Coefficient)". scikit-learn User Guide, accessed November 2026. scikit-learn.org/...clustering
  5. ^1 ^2 ^3 ^4scikit-learn developers. "Selecting the number of clusters with silhouette analysis on KMeans clustering". scikit-learn examples, accessed November 2026. scikit-learn.org/...plot_kmeans_silhouette_analysis
  6. ^1 ^2 ^3 ^4R package cluster. "Compute or Extract Silhouette Information from Clustering". R documentation, accessed November 2026. stat.ethz.ch/...silhouette
  7. ^1 ^2MathWorks. "silhouette". Statistics and Machine Learning Toolbox documentation, accessed November 2026. mathworks.com/...silhouette
  8. ^1 ^2 ^3 ^4 ^5 ^6 ^7 ^8 ^9 ^10Batool, Fatima; Hennig, Christian. "Clustering with the Average Silhouette Width". Computational Statistics & Data Analysis, vol. 158, 107190, 2021 (preprint arXiv:1910.11339). arxiv.org/...1910.11339
  9. ^1 ^2 ^3 ^4 ^5 ^6 ^7 ^8 ^9 ^10 ^11 ^12 ^13Lenssen, Lars; Schubert, Erich. "Clustering by Direct Optimization of the Medoid Silhouette". Similarity Search and Applications (SISAP 2022), Lecture Notes in Computer Science, pp. 190-204, 2022 (preprint arXiv:2209.12553). arxiv.org/...2209.12553
  10. ^Lenssen, Lars; Schubert, Erich. "Medoid Silhouette clustering with automatic cluster number selection". Information Systems, vol. 120, 102290, 2024 (preprint arXiv:2309.03751). arxiv.org/...2309.03751
  11. ^Arbelaitz, O.; Gurrutxaga, I.; Muguerza, J.; Pérez, J. M.; Perona, I. "An extensive comparative study of cluster validity indices". Pattern Recognition, vol. 46, no. 1, pp. 243-256, January 2013. doi.org/...j.patcog.2012.07.021
  12. ^1 ^2Gaido, Marco. "Distributed Silhouette Algorithm: Evaluating Clustering on Big Data". arXiv:2303.14102, March 2023. arxiv.org/...2303.14102
  13. ^1 ^2Apache Spark. "ClusteringEvaluator". PySpark 4.3.0 documentation, accessed November 2026. spark.apache.org/...evaluation.ClusteringEvaluator
  14. ^1 ^2Sarpe, Ilie; Altieri, Federico; Pietracaprina, Andrea; Pucci, Geppino; Vandin, Fabio. "Scalable and Distributed Silhouette Approximation". arXiv:2607.01993, July 2026. arxiv.org/...2607.01993
  15. ^1 ^2Pavlopoulos, John; Vardakas, Georgios; Likas, Aristidis. "Revisiting Silhouette Aggregation". arXiv:2401.05831, January 2024. arxiv.org/...2401.05831
  16. ^Crossref. "Silhouettes: A graphical aid to the interpretation and validation of cluster analysis" (metadata record, is-referenced-by count). Crossref REST API, accessed November 2026. api.crossref.org/...0377-0427(87)90125-7
  17. ^scikit-learn developers. "sklearn/metrics/cluster/_unsupervised.py" (silhouette_samples source). scikit-learn 1.9.1, GitHub. github.com/..._unsupervised.py
  18. ^1 ^2Sträng, Hugo; Dinh, Tai. "An upper bound on the silhouette evaluation metric for clustering". Pattern Recognition, vol. 178, 113402, 2026 (preprint arXiv:2509.08625). arxiv.org/...2509.08625
  19. ^Maechler, Martin; Rousseeuw, Peter; Struyf, Anja; Hubert, Mia; Hornik, Kurt; et al. "cluster: 'Finding Groups in Data': Cluster Analysis Extended Rousseeuw et al." R package version 2.1.8.3, CRAN, published 2026-07-30. cran.r-project.org/package=cluster

Improve this article

Add missing citations, update stale details, or write a clearer explanation. Anyone can edit: changes go live when you publish, and every edit is checked by an editor.

3 revisions · v3 · 2,882 words · full history

Fact-checks are independent of edits: a reviewer re-verifies the article against its sources and stamps the date. How we verify

Research and drafting on this wiki are AI-assisted, under named human editorial standards. How AI is used here

Reviewer note: Independent fact-check before publication on November 18, 2026: 64 claims checked against 21 cited and independent sources; 0 material and 1 minor correction applied before publication.

Cite this page: AI Wiki. "Silhouette score." aiwiki.ai, updated 2 Dec 2026, fact-checked 18 Nov 2026. CC BY 4.0. https://aiwiki.ai/wiki/silhouette_score

Edit article