Skip to content

k-means

learning

Level 2 of 3

Also called Lloyd's algorithm and k-means clustering.

fresh numbers

The test's questions that a run answers, asked again on new numbers whenever you like. The answer, its working and the reason for every other choice come from k-means's own run on the numbers shown.

choose one

question 1

Six points, 3 6, 6 10, 2 10, 1 3, 0 8 and 9 10, with two centres started at 2 10 and 1 3. How many rounds until no centre moves?

02468100246810
the answer, and why

the answer is B

Rounds 1 to 2 each move a centre. Round 3 changes nothing.

if you chose another

  • Round 2 still moves both centres, so one more round is needed to see none move.
  • Round 1 moves both centres, so it cannot be the last.
  • That is how many points there are.

new numbersthe test page's numbers

question 2

Six points, 5 5, 7 9, 1 2, 7 6, 6 5 and 6 4, with two centres started at 6 4 and 5 5. How many distances are measured in all?

02468100246810
the answer, and why

the answer is C

Each round measures 6 points against 2 centres, 12 distances, and there are 4 rounds.

if you chose another

  • That is one round only.
  • That counts 4 rounds of one distance a point.
  • That is one distance a point, once.

new numbersthe test page's numbers

question 3

Six points, 3 3, 4 9, 5 1, 2 7, 0 5 and 4 7, with two centres started at 4 9 and 2 7. How far does the second centre move in round 1?

02468100246810
the answer, and why

the answer is D

Its points are 3 3, 5 1, 2 7 and 0 5, whose middle is 2.5, 4. The centre started at 2, 7. 0.5 squared plus 3 squared is 9.25, and its root is about 3.04.

if you chose another

  • That is how far the first centre moves in round 1.
  • That is how far the second centre moves in round 2.
  • That is how far the first centre moves in round 2.

new numbersthe test page's numbers