Machine Learning — Cluster Validation: The Elbow Method and Silhouette Score

Rahul S
3 min readSep 6, 2023


Cluster analysis is a fundamental technique in unsupervised machine learning that involves grouping similar data points into clusters or groups. It plays a crucial role in various applications, from customer segmentation to image compression. Two common methods for determining the optimal number of clusters in a dataset are the “Elbow Method” and the “Silhouette Score.”


The Elbow Method is a simple yet effective technique for finding the optimal number of clusters (k) in a dataset.

It relies on the intuition that as you increase the number of clusters, the within-cluster variation (also known as the Sum of Squared Distances or SSD) or WCSS (Within cluster sum squared) typically decreases. However, there is a point where adding more clusters does not significantly reduce the SSD.

This point is known as the “elbow point,” and it represents a trade-off between minimizing the WCSS and avoiding overfitting.

The steps to apply the Elbow Method are as follows:

  1. Run the k-means clustering algorithm for a range of k values, typically from 1 to a reasonably large number.
  2. Calculate the SSD for each k.
  3. Plot the k values against their respective SSD values.
  4. Look for the “elbow” on the plot, which is the point where the SSD starts to level off.

In the plot, the elbow point is where the rate of decrease in SSD slows down, forming an elbow-like bend. This bend indicates a suitable number of clusters for your dataset.

However, it’s essential to note that the Elbow Method may not always yield a clear-cut answer. The optimal k might not be apparent, or there could be multiple potential elbows. It is a heuristic method and should be used in conjunction with other validation techniques and domain knowledge.


The Silhouette Score is another approach to assess the quality of clustering in a dataset and…