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, 1 1, 2 1, 1 3, 7 6, 8 8 and 9 6, with two centres started at 1 1 and 2 1. How many rounds until no centre moves?

02468100246810
the answer, and why

the answer is A

In round 1, the first centre takes 1, 1 and 1, 3 and moves to 1, 2; the second takes the rest and moves to 6.5, 5.25. In round 2, the point 2, 1 joins the first group, and both centres move again. Round 3 changes nothing.

if you chose another

  • Round 2 still moves both centres, so a third 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 numbers

question 2

On the same points and centres, how many distances are measured in all?

02468100246810
the answer, and why

the answer is A

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

if you chose another

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

new numbers

question 3

On the same points, how far does the second centre move in round 1?

02468100246810
the answer, and why

the answer is C

Its points are 2 1, 7 6, 8 8 and 9 6, whose middle is 6.5, 5.25. From 2, 1 that is 4.5 across and 4.25 up, the root of 38.31, about 6.19.

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 numbers