LightMySky
En anglais

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.

Commence ce sujetPas besoin de compte. La progression est enregistrée dans ce navigateur.

Ce que l'enfant saura faire ensuite

  • 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 · Lis

Every model so far, trees included, had a target column to score against. 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.

012345678910centre 1.5centre 8.5

Two groups after round one, with the centres moved to 1.5 and 8.5. Round two changes nothing.

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.

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.

The rewritten reading was written for this dataset.

2 · Regarde

En anglais

Sans écran

Imprimer une fiche d'exercicesFormat A4, avec une page de corrigés pour les adultes. Sans écran, sans internet.

Où se situe ce sujet

Puis s'entraîner

8 questions attendent derrière cette leçon, chacune avec sa réponse expliquée. Chaque réponse nourrit le ciel : les étoiles s'allument à mesure qu'elles sont apprises, et pâlissent quand vient le moment de revenir.

Commence ce sujet