Silhouette refers to a method of interpretation and validation of clusters of data. The technique provides a succinct graphical representation of how well each object lies within its cluster. It was first described by Peter J. Rousseeuw in 1986.
Assume the data have been clustered via any technique, such as k-means, into k clusters. For each datum, i let a(i) be the average dissimilarity of i with all other data within the same cluster. Any measure of dissimilarity can be used but distance measures are the most common. We can interpret a(i) as how well matched i is to the cluster it is assigned (the smaller the value, the better the matching). Then find the average dissimilarity of i with the data of another single cluster. Repeat this for every cluster of which i is not a member. Denote the lowest average dissimilarity to i of any such cluster by b(i). The cluster with this average dissimilarity is said to be the "neighbouring cluster" of i as it is, aside from the cluster i is assigned, the cluster in which i fits best. We now define:
Which can be written as:
From the above definition it is clear that
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 one means that the datum is appropriately clustered. If s(i) is close to negative one, 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 mean that the datum is on the border of two natural clusters.
The average s(i) of a cluster is a measure of how tightly grouped all the data in the cluster are. Thus the average s(i) the entire dataset is a measure of how appropriately the data has been clustered. If there are too many or too few clusters, such as a poor choice of k in the k-means algorithm, some of the clusters will display much narrower silhouettes than the rest. Thus silhoutte plots and averages are a powerful tool for determining the natural number of clusters within a dataset.