Working playground

Clustering Playground

Compare centroid-based and density-based clustering on shapes that expose their assumptions. K-Means trains one Lloyd step at a time; DBSCAN uses an actual ε-neighbourhood expansion.

Lab concept guide

What to observe while you experiment

K-Means and DBSCAN answer different geometric questions. K-Means repeatedly assigns points to the nearest centroid and updates centroids; DBSCAN expands clusters through ε-neighbourhoods around sufficiently dense core points and can label sparse points as noise.

MechanismFor K-Means, follow assignment → centroid update; for DBSCAN, inspect core, border and noise points as neighbourhoods expand.
Failure modeExpecting K-Means to recover non-convex shapes or expecting one DBSCAN ε/min-samples setting to work across very different densities.
VerificationOn a tiny point set, calculate one K-Means assignment/update or count one DBSCAN ε-neighbourhood manually and compare with the lab.
Experiment deliberately
Switch from blobs to moons, then from K-Means to DBSCAN. Predict which assignments will change and why before training.
Ready.