Clevix Ed

K-Means Clustering

Coding & AI · Class 9–12 · Unsupervised learning

All simulations
Tap to add a point · drag points or centroids (✚)

What to explore

Key ideas

K-means groups data into k clusters without any labels (unsupervised learning). It repeats two steps:

  1. Assign: every point joins its nearest centroid.
  2. Update: every centroid moves to the mean of its points.

It stops when nothing changes. The quality is measured by the inertia:

inertia = Σ (distance from point to its centroid)²

Teacher tip

Before pressing anything, ask students to predict where the crosses will end up. Then step through and compare.

Real uses: grouping customers by shopping habits, compressing image colours, grouping news stories.

Exam corner

In your syllabus

A free coding & ai simulation for Class 9–12.

Topics: clustering, k-means, unsupervised learning, centroid, elbow method, machine learning