The K-Means Cluster Sandbox
Centroid convergence and Voronoi partition dynamics on live point clouds.
What is The K-Means Cluster Sandbox?
K-Means Clustering is an unsupervised machine learning algorithm designed to automatically discover hidden natural groupings within unlabelled data points. By iteratively calculating geometric center points (centroids) and assigning each observation to its closest center, it carves the coordinate plane into distinct Voronoi cells, discovering intrinsic cluster patterns without requiring human supervision.
How the Interactive Simulation Works
Click to scatter data points and observe Lloyd's algorithm iteratively recomputing centroid gravity centers until convergence.
Mathematical Formulation & Computational Complexity
The simulation dynamically resolves the state transition function given by:
Lloyd's clustering algorithm executes in $\mathcal{O}(I \cdot K \cdot N \cdot D)$ time, where $K$ is cluster count, $N$ is total data points, $D$ is coordinate dimensions, and $I$ is iterations until Voronoi centroid convergence. Raising $K$ expands Voronoi cell boundaries and increases nearest-neighbor Euclidean distance comparisons per frame.
Industrial AI & Real-World Engineering Applications
Grouping purchasing cohorts by RFM (recency, frequency, monetary) feature vectors.
Reducing 24-bit RGB pixel representations to discrete color look-up tables in graphics pipelines.
Optimizing distribution center placement by minimizing aggregate route distances to regional delivery points.