7
Clustering — K-Means, Hierarchical Methods & Customer Segmentation
Summary
Unsupervised learning through clustering: building the K-means algorithm from scratch (distance computation, E-step centroid assignment, M-step mean recomputation), determining the right number of clusters with the Elbow method, agglomerative hierarchical clustering with dendrograms for multi-scale analysis, and a real-world customer segmentation project on the iFood marketing dataset (2,206 customers). Starts with Iris as a controlled testbed, then tackles messy real data.
Materials
THEORY
Clustering — Finding Structure Without Labels
How K-means discovers groups through iterative refinement, how to pick K, and how hierarchical clustering reveals structure at every scale.
NOTEBOOK
Clustering Notebook — K-Means from Scratch & Customer Segmentation
Implement K-means from scratch, apply the Elbow method, build dendrograms, and segment 2,206 real customers from the iFood dataset.
Includes notebook