freecoding.school100% FREE · NO SIGNUP
Tensor TownISSUE #10 of 120

clustering · k-means · dbscan

NeuraVSThe Overfit Ogre
Neura saysClustering groups similar points without labels — k-means and DBSCAN are the staples.

k-means partitions data into k clusters by repeatedly assigning points to the nearest center and recomputing centers — fast, but you must pick k and it assumes round, similar-sized clusters. DBSCAN groups by density, finding arbitrary shapes and labeling outliers as noise without needing k. Pick by your data's shape and whether you know the cluster count.

Power-ups you unlock

The Overfit Ogre attacks — common mistakes

Boss battlePick k-means or DBSCAN for tight blobs vs irregular shapes with outliers.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>round, known-count clusters → k-means
irregular shapes + outliers → DBSCAN (density)</pre></body></html>
▶ Open the interactive comic issue
‹ Classification Vs RegressionDimensionality Reduction · Pca · T-Sne · Umap ›