Skip to content
M.U.N.U.O.Data × AI × Systems

Machine Learning Foundations

Clustering with K-Means

Module 7 of 10

Learning objectives

  • Explain the ideas behind clustering with k-means.
  • Apply the ideas to the example and identify how you would check the result.

Concepts

K-means alternates between assigning each point to the nearest centroid and moving centroids to the mean of their assigned points. Scale features with very different units and compare multiple initializations.

Practical example

Group synthetic customer activity using monthly transaction count and total amount after scaling both features.

Try the exercise
  1. Define the task. Group synthetic customer activity using monthly transaction count and total amount after scaling both features.
  2. Identify the key idea. K-means alternates between assigning each point to the nearest centroid and moving centroids to the mean of their assigned points.
  3. Check your decision. Describe an alternative and how you would compare its results.
Open the interactive lab

Knowledge check

How does assignment work?

How is a centroid updated?

Why try multiple initializations?