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 9 across, 4 up, among 4 6 t, 6 3 s, 0 7 t and 4 1 s, with k = 2. How many distances are measured?

0510150510
the answer, and why

the answer is C

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

if you chose another

  • That counts only the 2 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 4 are measured.

new numbersthe test page's numbers

question 2

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

051015051015
the answer, and why

the answer is A

The ring of the 5 nearest reaches 8.6 and takes in both circles, at 6, 10 and 0, 5, 1 and 8.6 away.

if you chose another

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

new numbersthe test page's numbers

question 3

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

0510150510
the answer, and why

the answer is B

It just reaches the farthest of the 5 nearest, the square at 4, 10: 6 squared plus 4 squared is 52, and its root is about 7.21.

if you chose another

  • That is the second nearest, the square at 9, 8.
  • That is the triangle at 1, 2, the nearest outside the ring.
  • That is the farthest point of all, the triangle at 0, 2.

new numbersthe test page's numbers