Ch 11 · Clustering — Finding Groups Without Labels · Machine Learning & AI
Topic 11 of 13 in Machine Learning & AI — Foundations — 3 lessons.
Learning Without an Answer Key
So far every example came with an answer. Clustering throws the answers away: you hand the algorithm raw points and ask "which of these belong together?". k-means is the classic — you pick k (how many groups), and it finds k centres that each point can rally around.
Real k-means with scikit-learn
Let's make three blobs of points and let KMeans rediscover them. Cluster numbers are arbitrary (the algorithm doesn't know our names), so we print the things that are stable: the point counts and the sorted centres.
Seeing the Clusters
Numbers are fine, but clustering really clicks when you see it. This colours each point by the cluster KMeans assigned and marks the centres with an ✕.
All topics in Machine Learning & AI Beginner
- What Is Machine Learning?
- Data — Features, Labels & Splitting
- Linear Regression — Fitting a Line
- How Models Learn — Gradient Descent
- Classification — Predicting Categories
- Decision Trees
- Evaluating a Model Honestly
- Overfitting & the Bias-Variance Tradeoff
- The ML Workflow
- Mini-Project — A Spam Classifier
- Clustering — Finding Groups Without Labels
- Your First Real scikit-learn Model
- Words as Numbers — A Taste of NLP