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

05100510
the answer, and why

the answer is B

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

if you chose another

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

new numbersthe test page's numbers

question 2

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

0510150510
the answer, and why

the answer is B

The ring of the 3 nearest reaches 6 and takes in both circles, at 9, 3 and 6, 1, 1 and 4.24 away.

if you chose another

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

new numbersthe test page's numbers

question 3

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

0510-50510
the answer, and why

the answer is D

It just reaches the farthest of the 3 nearest, the square at 2, 3: 5 squared plus 3 squared is 34, and its root is about 5.83.

if you chose another

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

new numbersthe test page's numbers