AlgoPlus//machine learning / k-means
Read the theory

K-Means Clustering

Discover groups by alternating assign-to-nearest and move-to-mean.

Iter
k
3
Phase
Your points (x,y; separated, range 0–10)
Legend
Cluster 1
Cluster 2
Cluster 3
AI Tutor Workspace
In a nutshell
K-means sorts unlabeled points into k groups without being told what the groups are. It places k centroids (group centers), assigns every point to its nearest centroid, then moves each centroid to the average position of the points it captured. Repeating these two steps sharpens the groups until nothing changes — though the result depends on where the centroids started, so it finds a good grouping, not always the best possible one.
Ready
Press play to begin the cinematic walkthrough.
Drop k flags, let every point join its nearest flag, then move each flag to the middle of its crowd. Repeat — the flags drift until the crowds stop swapping.
Key terms
Go deeper in the lesson
Read the full theory, intuition & complexity for K-Means Clustering.