This sandbox was generated by Claude (Anthropic) for the ML 101 course materials. It runs two real clustering algorithms on a small seeded 2D dataset — K-means (Lloyd's iteration with a k-means++ start) and DBSCAN — and shows what the Module 5 lesson describes in words: the cluster assignment, the centroids, the DBSCAN core / border / noise labels, and the two quality scores the lessons name, inertia and the silhouette. Nothing is sketched — every point's colour is the label the algorithm computed for it.
The point of putting them side by side. K-means minimises the within-cluster sum of squares, so it always carves the plane into round, convex pieces — give it the two moons or the two rings and it splits them straight through, and the silhouette drops. DBSCAN grows clusters from dense core points, so it follows an arbitrary shape and calls the sparse points noise. Switch the dataset to moons or circles and flip between the two algorithms to watch exactly this.
Lloyd's algorithm is iterative, and this page is honest about it. It can settle into a local optimum, so the page runs several k-means++ restarts and keeps the lowest-inertia fit, and reports the iteration count and whether the assignment stabilised. The inertia is shown falling over the iterations; an unconverged run is never printed as the answer.
Computed: every dataset (seeded and reproducible), the K-means labels, centroids, inertia and its per-iteration history, the DBSCAN labels and core/border/noise types, the cluster and noise counts, the silhouette (overall and per point), the k-sweep of inertia and silhouette, and the sorted k-distance graph. Published figures: none. Chosen rather than computed: the four dataset shapes, the noise level, the point count, the seed, and the default k, epsilon and minPts.
Course demo — linked from the Module 5 lesson deck; the page itself is English‑only for now. Clustering finds structure with no labels to learn from. This page generates a seeded 2D dataset, runs a real K-means or DBSCAN on it, and shows the clusters it found and how good they are. One thing to take away: K-means assumes round clusters — on the moons and rings it fails and the silhouette says so — while DBSCAN follows the shape and separates them.