All lessons in Machine Learning Engineering: Reliable Predictive Models
K-Means and Cluster Validation
Trace centroid updates and evaluate cluster stability without inventing ground truth.
30 minutes · Free with an account · preview
What you will learn
- Trace k-means assignment and centroid-update steps by hand and verify that within-cluster sum of squares falls after each update.
- Compute a silhouette value for a single point and explain what it does and does not say about cluster quality.
- Judge cluster stability using restarts, resampling, and held-out data instead of treating cluster labels as discovered ground truth.
Everything earlier in the course used a label: a parcel was late or it was not, and models were scored against that fact. K-means removes the label. It asks whether dispatch records fall into natural groups when you look only at their features, such as dispatch load and weather risk. That freedom is useful for exploration and for building features, but it also removes the thing that made evaluation honest. There is no column to compare against, so the validation question changes from "how accurate is this" to "is this grouping real, stable, and useful." This lesson covers the algorithm mechanically and then spends equal effort on validation, because the second half is where most practical mistakes happen.
This is an optional lesson. You need only the ideas of a feature vector, Euclidean distance, and an arithmetic mean. No earlier optional branch is assumed.