k-means, properly
The oldest workhorse of clustering, taken apart. What it minimises, a proof that it can never make things worse, why it still gets stuck, how k-means++ seeding helps, how to choose k, and where the method's hidden assumptions break.
45 min
After this lesson you can
- Write the k-means objective and say what each symbol means
- Prove that neither the assignment step nor the update step can increase the objective, and that the loop terminates
- Explain why the result depends on the starting centroids, and implement k-means++ seeding
- Compute the elbow curve and the silhouette score, and say what each can and cannot tell you
- Predict when k-means will fail (elongated or unequal clusters, unscaled features)
In this lesson
- What k-means is trying to do
- Lloyd’s algorithm, and why it can’t make things worse
- Stuck in bad places, and how seeding helps
- In code
- Choosing K
- Where k-means breaks
This lesson is part of Descent Pro
Descent Pro unlocks every lesson on the route, from base camp to the summit. Every plan starts with a free trial.