LightMySky

Clustering: Structure Without Labels

With no target column, the question becomes which examples resemble each other. K-means alternates assigning points to the nearest centre and moving the centres, and the awkward parts are choosing k, choosing a distance, and deciding whether the groups mean anything.

No account needed. Progress saves in this browser.

What a learner can do afterwards

  • Run two rounds of k-means by hand on a small set of points
  • Show how different starting centres give different final groups
  • Say what makes a clustering result meaningful rather than merely tidy

1 · Read

With no target column, the question becomes which examples resemble each other. K-means answers it by alternating two steps: assign every point to its nearest centre, then move each centre to the middle of its new group. Repeat the pair until the groups stop moving.

Try it together

Run two rounds by hand on points at 1, 2, 8 and 9, with starting centres at 1 and 9. Round one assigns 1 and 2 to the first centre and 8 and 9 to the second, then the centres move to 1.5 and 8.5. Round two assigns the same way, so the groups hold. Now notice the trap: different starting centres can end in different final groups.

Before running k-means you must choose k, the number of centres, plus the distance you measure with. K-means is happiest when points form round, similarly sized blobs, since it always builds groups around a centre point. A wrong k forces the data into neat round groups that do not really exist.

Good to know

A clustering result is not meaningful just because the algorithm finished. It is meaningful when the groups are tight inside, well separated from each other, and say something true about the data. Other shapes need other tools: DBScan walks point to point pulling in close neighbours, so it can find long stretched groups and label stray points as noise.

Alternate assign and move, choose k and distance with care, and trust only groups that are tight, separated and true.

2 · Watch

Take it off screen

Print a worksheetA4 with an answer key page for grown-ups. No screen, no internet.

Where it sits

Then practise

8 questions wait behind this lesson, each with its answer explained. Every answer feeds the sky: stars light as they are learned, and dim when it is time to come back.

Spotted a problem on this page? Tell us
Clustering: Structure Without Labels · Computing, ages 20 to 22 · LightMySky