How does the gap statistic work?
hardAnswer
- Compare observed within-cluster dispersion to expected under a null reference distribution (uniform in the bounding box).
- .
- Pick smallest k such that Gap(k) ≥ .
- More principled than the elbow; handles cluster-vs-no-cluster case (returns k=1 when data is unstructured).
- Costly (needs B ~ 20 reference simulations).
Check yourself — multiple choice
- Same as elbow
- Compare log to expected under uniform null; pick smallest k with Gap(k) ≥ Gap(k+1) - s; handles k=1 case; costly
- Random
- Only tiny data
Gap statistic: log vs uniform null; principled k selection.
#clustering#evaluation
Practise Unsupervised Learning
214 interview questions in this topic.