Plotara guide
Elbow plot: choosing k for k-means clustering
How to read an elbow plot, what to do when there is no obvious elbow, and which methods to use alongside it.
K-means needs you to specify the number of clusters in advance. The elbow plot is the standard way to make that choice defensible.
What it shows
The x-axis is the number of clusters, k. The y-axis is within-cluster sum of squares, the total squared distance from each point to its cluster centre.
WCSS always falls as k rises, and reaches zero when k equals the number of data points. So you are not looking for a minimum. You are looking for the point where the improvement stops being worth the extra cluster.
Reading it
The curve drops steeply, then flattens. The elbow is where it bends. Adding clusters before the elbow buys a large improvement in fit; adding them after buys very little.
When there is no obvious elbow
Common, and it means one of these:
- Your data have no clear cluster structure. A valid finding worth reporting. - The clusters overlap heavily. - The clusters are not roughly spherical, which is what k-means assumes. - Your variables are on different scales. Standardise before clustering. A variable measured in thousands will dominate one measured in units.
Use a second method
The elbow is a judgement call, so support it. Silhouette score measures how well each point sits in its own cluster versus the nearest other one, and has a genuine maximum you can point at. Gap statistic compares your WCSS against what you would get from random data.
Agreement between the elbow and the silhouette is a much stronger justification than either alone.
In Plotara
K-means clustering with elbow plots, alongside PCA for checking whether your data have visible structure before you cluster at all.
Ready to put this into practice?
Try Plotara free for 30 daysNo credit card required. Windows and Mac.