Elbow Method

Machine Learning
Introduced by
Robert Thorndike
Year
1953
Type
Heuristic optimization criterion
Family
Cluster Number Selection

What does it do?

The Elbow Method is a heuristic for choosing the number of clusters in partitional clustering, most often k-means.

It fits clustering models for a range of cluster counts and plots the within-cluster sum of squares (WCSS) against the number of clusters. The 'elbow', the point where the decrease in WCSS changes from steep to gradual, is taken as a suggested cluster count.

The intuition behind the method

Adding clusters tends to lower WCSS, because each point can sit closer to its centroid. When the data contain distinct groups, the first additional clusters usually reduce WCSS sharply, since they separate those groups. Beyond some point the gains flatten, and extra clusters mainly subdivide noise or fine detail. The elbow marks this transition, giving a visual trade-off between a simpler model and a better fit. It needs no labels or external validation data, but the reading of the curve is a judgement.

History

The Elbow Method is widely used in k-means workflows and is often reported alongside the silhouette score and the gap statistic. The gap statistic was developed as a more formal procedure for the same question (Kassambara, pp. 134-135). Hastie, Tibshirani, and Friedman (2009) cover k-means clustering in the context of unsupervised learning.

When to use it

Choose the Elbow Method for a quick, label-free first estimate of the cluster count, particularly when you already use k-means and want an inexpensive diagnostic. It is best suited to data where clusters are roughly spherical and of similar size, since WCSS directly measures within-cluster spread around centroids. Do not rely on it alone when the WCSS curve falls smoothly with no visible knee, when clusters are elongated or non-convex, or when the data are high-dimensional and distances are less informative. In those cases, compare the result with criteria such as the silhouette score or the gap statistic, which are listed as related methods. Because the elbow reading is a judgement, and the elbow and silhouette criteria assess only global clustering structure, the gap statistic is the more formal cross-check: it provides a statistical procedure that formalises the elbow and silhouette judgements (Kassambara, pp. 134-135).

Limitations and considerations

  • The elbow is a judgement: the curve may have no clear knee, and different readers may choose different values of k.
  • WCSS is the k-means objective, so the method implicitly favours compact, roughly spherical, similarly sized clusters.
  • Each candidate k requires a separate clustering run, so the cost grows with the range tested.
  • WCSS values depend on the clustering run; k-means local optima and random initialisation can make the curve noisy.
  • The elbow and average silhouette criteria measure only global clustering characteristics, so they can point to a different k than a more formal comparison such as the gap statistic (Kassambara, pp. 134-135).

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Needs only the WCSS values produced by the clustering runs, with no labels or ground truth.
  • The only choices are the range of k and the clustering settings, so the procedure is simple to repeat.
  • The plot shows how fit improves with each added cluster, which helps non-specialists understand the trade-off.

Applications

  • Customer segmentation: k-means on customer feature vectors, with the WCSS curve used to choose the number of segments.
  • Image quantization: choosing the number of colour clusters for k-means palette reduction.
  • Gene expression profiling: selecting the number of groups when k-means is applied to expression profiles.
  • Feature engineering: choosing the number of clusters for cluster-membership features derived from k-means.

How it works

How it works

1

Run a clustering algorithm, typically k-means, for each cluster count k in a chosen range from 1 to a maximum K. Each value of k requires its own fit, so the cost grows with the number of values tested.

Formula
\text{Fit clustering for } k = 1, 2, \ldots, K
2

For each k, compute the WCSS: the sum of squared Euclidean distances from each point to the centroid of its assigned cluster.

Formula
\text{Compute within-cluster sum of squares (WCSS) for each } k
3

Plot k on the horizontal axis and WCSS on the vertical axis. The curve typically falls steeply at first and then flattens.

Formula
\text{Plot WCSS vs. } k
4

Locate the knee where the curve changes from steep to flat, either by inspection or with an automatic knee-detection method. The corresponding k is the suggested cluster count. If more than one bend is plausible, compare the candidate values of k rather than accepting the first that looks like a knee. Report the chosen k together with the WCSS values, and check it against silhouette or gap-statistic results. In a worked R example (Kassambara, p. 134), the elbow and the gap statistic both suggested k = 4, while the silhouette method suggested k = 2; k = 4 was then adopted as the optimal number of clusters.

Formula
\text{Identify knee point where marginal improvement diminishes}

Common pitfalls

  • Assuming a clear elbow always exists; many datasets give a gradual, steadily decreasing curve with no sharp knee.
  • Reading the elbow from a plot whose axes are scaled differently, since the apparent knee can move with the scaling.
  • Testing too narrow a range of k, so that the knee falls outside the range examined.
  • Computing WCSS on unscaled features, so that features with large ranges dominate the distances and the curve.

Frequently asked questions

How do I detect the elbow automatically instead of judging it by eye?

Automatic knee-detection methods locate a knee in a curve. Their criteria and parameters differ between methods and should be checked in each method's original publication. They may not agree with visual judgement in every case, so report which approach you used.

What if I do not see a clear elbow?

If the WCSS curve decreases smoothly without a sharp knee, the Elbow Method may not be suitable for your data. Combine it with other metrics such as the silhouette score, the gap statistic, or domain knowledge to inform your choice.

Does the Elbow Method work with non-Euclidean distances?

The WCSS used here is a sum of squared Euclidean distances to centroids, which is the k-means objective. Another distance requires a different within-cluster dispersion measure, so the standard procedure does not transfer directly. Check the chosen measure's properties before interpreting the curve.

Should I apply the method to raw data or to scaled data?

Standardising features is commonly recommended before k-means, because WCSS is computed from raw distances and features with large ranges dominate it. Report the preprocessing you used, since it changes the curve.

Related methods

Sources

  1. Hastie, T., Tibshirani, R., & Friedman, J. (2009). The Elements of Statistical Learning: Data Mining, Inference, and Prediction. Springer Series in Statistics.

    Open publication reference
  2. Thorndike, R. L. (1953). Who belongs in the family? Psychometrika, 18(4), 267-276.

    Open DOI reference
  3. [Alboukadel_Kassambara]_Practical_Guide_to_Cluster(z-lib.org), p. 134-135