k-Means Clustering

18 min read

Sometimes you have data but no answers to learn from. k-means finds groups in such data by itself. A shop can use it to group customers, and a company can use it to place delivery hubs.

New words

Cluster
A group of points that sit close to each other.
Centroid
The centre of a cluster. It is the mean of its points.
k
The number of clusters you ask k-means to find.
Unsupervised learning
Learning from data that has no labels or answers.
Elbow
The bend in a graph where adding more clusters stops helping much.
Scaling
Changing columns to a similar range so none of them dominates.

What you will learn

  1. Where would you put 3 delivery hubs?
  2. What is a centroid, and how far is a point?
  3. Step 1: give every point to its nearest centre
  4. Step 2: move every centre to the middle of its group
  5. When does it stop?
  6. Try it: watch the centres move
  7. How do you choose k?
  8. Bad starting points and other limits
  9. Common mistakes
  10. Explain it to a friend
  11. Key takeaways

10 quiz questions at the end.

Start this lesson

The full lesson, with interactive demos and the quiz, opens after you sign in with Google. It is free.

All lessons · Back to the roadmap