Lably
Skip to content

Silhouette (clustering)

Quality measure in cluster analysis

  • 6 min read
  • 4 chapters

Related on Lably

Through Distance, Euclidean distance and K-means clustering

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. 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. The silhouette value can be calculated with any distance metric, such as Euclidean distance or Manhattan distance.

Definition

Assume the data have been clustered via any technique, such as k-medoids or k-means, into k clusters.

For data point i∈Ci (data point i in the cluster Ci), calculate a(i), the average distance that i is from all other points in that cluster:

a(i)=1|Ci|−1∑j∈Ci,i≠jd(i,j)

where |Ci| is the number of points belonging to cluster Ci, and d(i,j) is the distance between data points i and j in the cluster Ci (we divide by |Ci|−1 because the distance d(i,i) is not included in the sum). a(i) can be interpreted as a measure of how well i is assigned to its cluster (the smaller the value, the better the assignment).

We then define the mean dissimilarity of point i to some cluster Cj as the mean of the distance from i to all points in Cj (where Cj≠Ci).

For each data point i∈Ci, we now define b(i) as the average distance between i and the points in the closest cluster (hence: "min") that i does not belong to:

b(i)=minj≠i1|Cj|∑l∈Cjd(i,l)

The cluster with the smallest mean dissimilarity is said to be the "neighboring cluster" of i because it is the next best fit cluster for point i.

We now define a silhouette (value) of one data point i

s(i)=b(i)−a(i)max{a(i),b(i)}, if |Ci|>1

and

s(i)=0, if |Ci|=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)

From the above definition, s(i) is bounded to the interval [−1,1], i.e. −1≤s(i)≤1.

Note that a(i) is not clearly defined for clusters with size = 1, in which case we set s(i)=0. This choice is arbitrary, but neutral in the sense that it is at the midpoint of the bounds, -1 and 1.

For s(i) to be close to 1 we require a(i)≪b(i). As a(i) is a measure of how dissimilar i is to its own cluster, a small value means it is well matched. Furthermore, a large b(i) implies that i is badly matched to its neighbouring cluster. Thus an s(i) close to 1 means that the data is appropriately clustered. If s(i) is close to -1, then by the same logic we see that i would be more appropriate if it was clustered in its neighbouring cluster. An s(i) near zero means that the datum is on the border of two natural clusters.

The mean 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) 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 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.

Kaufman et al. introduced the term silhouette coefficient for the maximum value of the mean s(i) over all data of the entire dataset, i.e.,

SC=maxks~(k),

where s~(k) represents the mean s(i) over all data of the entire dataset for a specific number of clusters k. The silhouette coefficient describes the best possible clustering possible for a given number of clusters, as measured by the highest average silhouette score for all points in the dataset.

Sign in to keep reading

3 more chapters are free with a Lably account.

More in Robotics