Finding groups without labels
Explore how K-means groups unlabeled data by repeatedly assigning points to centers and then moving those centers to better represent the data.
Before We Begin
Clustering is about finding structure when no answer key has been provided. Instead of predicting a known label, the model searches for natural groupings based on similarity. K-means does this with a simple loop: assign points to the nearest center, move the centers, and repeat.
How this lesson fits
This module is where the course shifts from explicit rules to learned patterns. Instead of telling the machine exactly what to do in every case, we give it examples, define success, and let it infer a decision rule from the data.
The big question
How can a machine study examples, extract useful patterns, and make predictions on cases it has never seen before?
Why You Should Care
Students often assume all machine learning depends on labeled data. Clustering breaks that assumption and shows that one major use of ML is exploratory: revealing patterns, segments, or hidden organization that humans did not label ahead of time.
Where this is used today
Think of it like this
Imagine sorting a mixed box of LEGO bricks without instructions. You could organize them by color, by size, or by shape. There may be several reasonable groupings, and the point is to choose one that reveals useful structure.
Easy mistake to make
K-means does not uncover one final, objective truth hiding in the data. Different values of K and different definitions of similarity can produce different but still useful groupings.
Think about this first
If you had to sort a pile of mixed objects with no labels, what clues would you rely on first, and how would you decide whether two objects belong together?
Words we will keep using
Clustering is like sorting a bucket of mixed LEGOs when you lost the instruction manual. You don't know what the groups are supposed to be, so you organize them by what looks similar—color, size, or shape.
Press start and watch the two repeating moves: assign points, then move centroids.
How many clusters should you use? The "Elbow Method" is a rule of thumb: keep adding clusters until the improvement slows down. It's like eating pizza—the first slice is amazing, the fifth one is just okay.
Red dot = elbow at K=3. Adding more clusters beyond this gives diminishing returns.