Skip to content
ML to LLMs
Labs / Classical ML

K-means clustering

Place centroids, step through assignment and update, and change K and the initialization.

Theory and worked examples: K-means clustering

K-means lab

Synthetic data. Round, similar-size, well-separated groups: the case K-means is built for.

K-means clustering02468100246810feature 1feature 2
× centroids (μ)points colored by assigned cluster
Centroids are placed. Press “Assign” to give each point to its nearest centroid.