Concepts 🚀 Project 🧮 Labs
🧮 Labs / ML Advanced / Interactive: K-Means — drag K and watch centroids + clusters

Interactive: K-Means — drag K and watch centroids + clusters

DRAG the K slider. SEE centroids move. SEE clusters form. SEE the elbow plot update. Find the natural number of clusters.

interactive.lab v3.1
Drag the sliders — see the graph update in real-time
Live interactive chart drag sliders → graph updates
If you see this, the interactive chart is loading...
If it doesn't appear in 2 seconds, press Ctrl+Shift+R to hard refresh.
🧠 How it works

INTERACTIVE K-MEANS: K-Means is UNSUPERVISED — it finds structure without labels. ALGORITHM: (1) place K centroids randomly, (2) assign each point to nearest centroid, (3) move centroid to mean of its points, (4) repeat until stable. DRAG K and watch: K=1: all points are one cluster. Inertia is HIGH (spread out). K=3: clusters form naturally (this data has 3 real groups). K=8: too many clusters — splits natural groups. Inertia is low but meaningless. ELBOW PLOT: inertia vs K. The BEND is the natural K. For this data: elbow at K=3. K-Means finds the 3 groups WITHOUT being told they exist!

✏️ Try these changes
  • Set K=1 — all one cluster
    → inertia is maximum — no structure found
  • Set K=3 — natural clusters
    → 3 tight clusters — this is the elbow
  • Set K=8 — too many clusters
    → splits natural groups — overfitting the clustering