Silhouette (clustering) ======================= * Article) * Talk) **Silhouette** is a method of interpretation and validation of consistency within clusters of data . The technique provides a succinct graphical representation of how well each object has been classified.[\[1\]](https://en.wikipedia.org/wiki/Silhouette_%28clustering%29?utm_source=chatgpt.com#cite_note-Rousseeuw_1987-1) It was proposed by Belgian statistician Peter Rousseeuw in 1987. The silhouette value is a measure of how similar an object is to its own cluster (cohesion) compared to other clusters (separation). The silhouette value ranges from −1 to +1, where a high value indicates that the object is well matched to its own cluster and poorly matched to neighboring clusters. If most objects have a high value, then the clustering configuration is appropriate. If many points have a low or negative value, then the clustering configuration may have too many or too few clusters. A clustering with an average silhouette width of over 0.7 is considered to be "strong", a value over 0.5 "reasonable", and over 0.25 "weak". However, with an increasing dimensionality of the data, it becomes difficult to achieve such high values because of the curse of dimensionality , as the distances become more similar.[\[2\]](https://en.wikipedia.org/wiki/Silhouette_%28clustering%29?utm_source=chatgpt.com#cite_note-2) The silhouette score is specialized for measuring cluster quality when the clusters are convex-shaped, and may not perform well if the data clusters have irregular shapes or are of varying sizes.[\[3\]](https://en.wikipedia.org/wiki/Silhouette_%28clustering%29?utm_source=chatgpt.com#cite_note-3) The silhouette value can be calculated with any distance metric, such as Euclidean distance or Manhattan distance . Contents -------- * 1 Definition * 2 Simplified Silhouette and Medoid Silhouette * 3 Silhouette Clustering * 4 See also * 5 References Definition ---------- edit&action=edit&section=1 "Edit section: Definition")  A plot showing silhouette scores from three types of animals from the Zoo dataset as rendered by Orange "Orange (software)") data mining suite. At the bottom of the plot, silhouette identifies dolphin and porpoise as outliers in the group of mammals. Assume the data have been clustered via any technique, such as k-medoids or k-means , into k {\\displaystyle k} clusters. For data point i ∈ C i {\\displaystyle i\\in C\_{i}} (data point i {\\displaystyle i} in the cluster C i {\\displaystyle C\_{i}} ), let a ( i ) \= 1 | C i | − 1 ∑ j ∈ C i , i ≠ j d ( i , j ) {\\displaystyle a(i)={\\frac {1}{|C\_{i}|-1}}\\sum \_{j\\in C\_{i},i\\neq j}d(i,j)} be the mean distance between i {\\displaystyle i} and all other data points in the same cluster, where | C i | {\\displaystyle |C\_{i}|} is the number of points belonging to cluster C i {\\displaystyle C\_{i}} , and d ( i , j ) {\\displaystyle d(i,j)} is the distance between data points i {\\displaystyle i} and j {\\displaystyle j} in the cluster C i {\\displaystyle C\_{i}} (we divide by | C i | − 1 {\\displaystyle |C\_{i}|-1} because the distance d ( i , i ) {\\displaystyle d(i,i)} is not included in the sum). a ( i ) {\\displaystyle a(i)} can be interpreted as a measure of how well i {\\displaystyle i} is assigned to its cluster (the smaller the value, the better the assignment). We then define the mean dissimilarity of point i {\\displaystyle i} to some cluster C j {\\displaystyle C\_{j}} as the mean of the distance from i {\\displaystyle i} to all points in C j {\\displaystyle C\_{j}} (where C j ≠ C i {\\displaystyle C\_{j}\\neq C\_{i}} ). For each data point i ∈ C i {\\displaystyle i\\in C\_{i}} , we now define b ( i ) \= min J ≠ I 1 | C j | ∑ j ∈ C j d ( i , j ) {\\displaystyle b(i)=\\min \_{J\\neq I}{\\frac {1}{|C\_{j}|}}\\sum \_{j\\in C\_{j}}d(i,j)} to be the _smallest_ (hence the min {\\displaystyle \\min } operator in the formula) mean distance of i {\\displaystyle i} to all points in any other cluster (i.e., in any cluster of which i {\\displaystyle i} is not a member). The cluster with the smallest mean dissimilarity is said to be the "neighboring cluster" of i {\\displaystyle i} because it is the next best fit cluster for point i {\\displaystyle i} . We now define a _silhouette_ (value) of one data point i {\\displaystyle i} s ( i ) \= b ( i ) − a ( i ) max { a ( i ) , b ( i ) } {\\displaystyle s(i)={\\frac {b(i)-a(i)}{\\max\\{a(i),b(i)\\}}}} , if | C i | \> 1 {\\displaystyle |C\_{i}|>1} and s ( i ) \= 0 {\\displaystyle s(i)=0} , if | C i | \= 1 {\\displaystyle |C\_{i}|=1} , which can also be written as s ( i ) \= { 1 − a ( i ) b ( i ) , if a ( i ) < b ( i ) 0 , if a ( i ) \= b ( i ) b ( i ) a ( i ) − 1 , if a ( i ) \> b ( i ) {\\displaystyle s(i)={\\begin{cases}1-{\\frac {a(i)}{b(i)}},&{\\mbox{ if }}a(i)<b(i)\\\\0,&{\\mbox{if }}a(i)=b(i)\\\\{\\frac {b(i)}{a(i)}}-1,&{\\mbox{ if }}a(i)>b(i)\\\\\\end{cases}}} From the above definition, s ( i ) {\\displaystyle s(i)} is bounded to the interval ( − 1 , 1 ) {\\displaystyle (-1,1)} , i.e. − 1 ≤ s ( i ) ≤ 1. {\\displaystyle -1\\leq s(i)\\leq 1.} Note that a ( i ) {\\displaystyle a(i)} is not clearly defined for clusters with size = 1, in which case we set s ( i ) \= 0 {\\displaystyle s(i)=0} . This choice is arbitrary, but neutral in the sense that it is at the midpoint of the bounds, -1 and 1.[\[1\]](https://en.wikipedia.org/wiki/Silhouette_%28clustering%29?utm_source=chatgpt.com#cite_note-Rousseeuw_1987-1) For s ( i ) {\\displaystyle s(i)} to be close to 1 we require a ( i ) ≪ b ( i ) {\\displaystyle a(i)\\ll b(i)} . As a ( i ) {\\displaystyle a(i)} is a measure of how dissimilar i {\\displaystyle i} is to its own cluster, a small value means it is well matched. Furthermore, a large b ( i ) {\\displaystyle b(i)} implies that i {\\displaystyle i} is badly matched to its neighbouring cluster. Thus an s ( i ) {\\displaystyle s(i)} close to 1 means that the data is appropriately clustered. If s ( i ) {\\displaystyle s(i)} is close to -1, then by the same logic we see that i {\\displaystyle i} would be more appropriate if it was clustered in its neighbouring cluster. An s ( i ) {\\displaystyle s(i)} near zero means that the datum is on the border of two natural clusters. The mean s ( i ) {\\displaystyle s(i)} over all points of a cluster is a measure of how tightly grouped all the points in the cluster are. Thus the mean s ( i ) {\\displaystyle s(i)} over all data of the entire dataset is a measure of how appropriately the data have been clustered. If there are too many or too few clusters, as may occur when a poor choice of k {\\displaystyle k} is used in the clustering algorithm (e.g., k-means ), some of the clusters will typically display much narrower silhouettes than the rest. Thus silhouette plots and means may be used to determine the natural number of clusters within a dataset. One can also increase the likelihood of the silhouette being maximized at the correct number of clusters by re-scaling the data using feature weights that are cluster specific.[\[4\]](https://en.wikipedia.org/wiki/Silhouette_%28clustering%29?utm_source=chatgpt.com#cite_note-4) Kaufman et al. introduced the term _silhouette coefficient_ for the maximum value of the mean s ( i ) {\\displaystyle s(i)} over all data of the entire dataset,[\[5\]](https://en.wikipedia.org/wiki/Silhouette_%28clustering%29?utm_source=chatgpt.com#cite_note-5) i.e., S C \= max k s ~ ( k ) , {\\displaystyle SC=\\max \_{k}{\\tilde {s}}\\left(k\\right),} where s ~ ( k ) {\\displaystyle {\\tilde {s}}\\left(k\\right)} represents the mean s ( i ) {\\displaystyle s(i)} over all data of the entire dataset for a specific number of clusters k {\\displaystyle k} .