An interactive, step-by-step tutorial that shows exactly how K-means clustering works—from centroid initialization through assignment, mean recalculation, and convergence.
- A controllable K-means animation with play, pause, reset, speed, and K controls
- Euclidean distance calculations for every point and centroid
- Coordinate-by-coordinate centroid mean calculations
- Live SSE (within-cluster sum of squares)
- Selectable points for inspecting individual calculations
- A complete tutorial covering initialization, assignment, update, convergence, the objective function, choosing K, and practical limitations
- Responsive and keyboard-accessible design with reduced-motion support
No build step or dependencies are required. Open index.html directly, or serve the folder with any static server:
python -m http.server 8000Then visit http://localhost:8000.
The browser computes each K-means step from the displayed coordinates. The values in the plot, distance table, centroid equations, and SSE label all come from the same live algorithm state.
MIT