Skip to content

k-nearest neighbours

learning

Level 1 of 3

Also called k-NN and Nearest neighbour classification.

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-nearest neighbours's own run on the numbers shown.

choose one

question 1

A new point at 10 across, 1 up, among 7 5 t, 8 8 c, 0 9 c, 5 0 c, 0 0 c, 1 7 t and 3 9 t, with k = 5. How many distances are measured?

05101520-10-50510
the answer, and why

the answer is C

One for each of the 7 points, before any vote.

if you chose another

  • That counts only the 5 that vote.
  • That counts every step of the run, the start, the ring, the vote and the verdict too.
  • That is the nearest point alone; it is found only after all 7 are measured.

new numbersthe test page's numbers

question 2

A new point at 5 across, 6 up, among 9 7 s, 2 4 c, 7 6 c, 8 0 t, 9 1 s, 9 8 t and 9 9 t, with k = 3. How many circles are inside the ring?

02468100510
the answer, and why

the answer is A

The ring of the 3 nearest reaches 4.12 and takes in both circles, at 7, 6 and 2, 4, 2 and 3.61 away.

if you chose another

  • There are only 2 circles among the points.
  • That leaves out the circle at 2, 4.
  • The nearest point is a circle.

new numbersthe test page's numbers

question 3

A new point at 5 across, 4 up, among 0 10 c, 1 4 t, 4 9 t, 3 9 s, 7 8 s and 10 0 t, with k = 3. How far does the ring reach?

05100510
the answer, and why

the answer is B

It just reaches the farthest of the 3 nearest, the triangle at 4, 9: 1 squared plus 5 squared is 26, and its root is about 5.1.

if you chose another

  • That is the second nearest, the square at 7, 8.
  • That is the square at 3, 9, the nearest outside the ring.
  • That is the farthest point of all, the circle at 0, 10.

new numbersthe test page's numbers