Silhouette score
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 for algorithms such as k-means and k-medoids [2][3][8].
Definition
Let a dataset be divided into clusters and let be the dissimilarity (often a distance) between objects and . For an object assigned to cluster , the quantities below follow the notation of Struyf, Hubert and Rousseeuw (1997) [2]:
- is the average dissimilarity of to all other objects of :
- For every other cluster , is the average dissimilarity of to all objects of , and is the smallest of these:
The cluster that attains this minimum is called the neighbor of , its second-best cluster [2]. The silhouette value of is then
which always lies between -1 and 1 [2]. The overall score is the mean of over all objects, called the average silhouette width (ASW) [2][9]:
The silhouette is only defined when the number of clusters satisfies [3][6]. If an object is the only member of its cluster, cannot be computed; the R cluster package and Batool and Hennig set 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 | Meaning |
|---|---|
| Close to 1 | Object is well classified: it is much closer to its own cluster than to the neighbor cluster |
| Close to 0 | Object lies between two clusters () |
| Close to -1 | Object is badly classified: it is closer to the neighbor cluster than to its own |
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 , 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, in cluster A and in cluster B, with absolute difference as the distance. For the point 3, the average distance to the other members of A is and the average distance to B is , so . 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.
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
The silhouette of a single cluster is a plot of all its 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 and selecting the that gives the highest average silhouette width; that maximum over 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 coefficient | Proposed interpretation [2] |
|---|---|
| 0.71 to 1.00 | A strong structure has been found |
| 0.51 to 0.70 | A reasonable structure has been found |
| 0.26 to 0.50 | The structure is weak and could be artificial; try additional methods |
| 0.25 or less | No substantial structure has been found |
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 clusters | Average silhouette score [5] |
|---|---|
| 2 | 0.705 |
| 3 | 0.588 |
| 4 | 0.651 |
| 5 | 0.561 |
| 6 | 0.486 |
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 , the ASW can be tempted to choose too low a 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 when the global optimum is at 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 [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 when merging groups makes the remaining clusters far apart [8].
- Quadratic cost. Exact computation needs all pairwise dissimilarities, which takes time, far more than popular clustering algorithms such as k-means [9]. Sarpe and colleagues put the cost at 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 time [9]. When every point is assigned to its closest center, the value reduces further to the medoid silhouette,
where and are the distances from point 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 [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 [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 distance computations to estimate both individual and global silhouettes within additive error with probability at least , together with MapReduce and massively parallel designs [14].
Software implementations
| Software | Function | Notes |
|---|---|---|
| scikit-learn (Python) | silhouette_score, silhouette_samples | Mean 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 package | silhouette() | Per-object widths, neighbor cluster and summaries for any partition; hierarchical clusterings via cutree() [6] |
| MATLAB | silhouette | Silhouette plot and values; squared Euclidean distance by default; singleton points set to 1 [7] |
| Apache Spark ML | ClusteringEvaluator | Squared Euclidean (default) or cosine distance, linear-time algorithm [12][13] |
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
- ClusteringClustering is an unsupervised learning technique that groups a set of data points into clusters so that points in the same cluster are more similar to each other than to points in other clustersMentioned 14 times above
- K-MeansK-means is an unsupervised machine learning clustering algorithm that partitions a dataset into k distinct, non-overlapping clusters by repeatedly assigning each data point to its nearest cluster center and…Mentioned 5 times above
- Hierarchical ClusteringHierarchical clustering is an unsupervised learning method that groups data into a tree of nested clusters, building the hierarchy by repeatedly merging the most similar groups (agglomerative, bottom-up) or…Listed in See also
- DBSCANDBSCAN (Density-Based Spatial Clustering of Applications with Noise) is a density-based clustering algorithm that groups together points packed closely in feature space and labels points in low-density regions…Listed in See also
- K-MedianK-median clustering (also written k-medians) is a partitioning-based clustering algorithm that divides a dataset of…Listed in See also
- CentroidA centroid is the geometric center of a set of points, computed as the arithmetic mean of their coordinates: each component of the centroid is the average of that coordinate across all the points.Listed in See also
More from See also
More to read
References
- ^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
- ^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
- ^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
- ^1 ^2 ^3scikit-learn developers. "Clustering: Clustering performance evaluation (Silhouette Coefficient)". scikit-learn User Guide, accessed November 2026. scikit-learn.org/...clustering
- ^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
- ^1 ^2 ^3 ^4R package cluster. "Compute or Extract Silhouette Information from Clustering". R documentation, accessed November 2026. stat.ethz.ch/...silhouette
- ^1 ^2MathWorks. "silhouette". Statistics and Machine Learning Toolbox documentation, accessed November 2026. mathworks.com/...silhouette
- ^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
- ^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
- ^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
- ^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
- ^1 ^2Gaido, Marco. "Distributed Silhouette Algorithm: Evaluating Clustering on Big Data". arXiv:2303.14102, March 2023. arxiv.org/...2303.14102
- ^1 ^2Apache Spark. "ClusteringEvaluator". PySpark 4.3.0 documentation, accessed November 2026. spark.apache.org/...evaluation.ClusteringEvaluator
- ^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
- ^1 ^2Pavlopoulos, John; Vardakas, Georgios; Likas, Aristidis. "Revisiting Silhouette Aggregation". arXiv:2401.05831, January 2024. arxiv.org/...2401.05831
- ^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
- ^scikit-learn developers. "sklearn/metrics/cluster/_unsupervised.py" (silhouette_samples source). scikit-learn 1.9.1, GitHub. github.com/..._unsupervised.py
- ^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
- ^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




