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

051015051015
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 3 across, 2 up, among 4 3 c, 8 1 s, 1 10 t, 10 8 t, 1 8 c and 10 0 t, with k = 3. How many circles are inside the ring?

0510-50510
the answer, and why

the answer is D

The ring of the 3 nearest reaches 6.32 and takes in both circles, at 4, 3 and 1, 8, 1.41 and 6.32 away.

if you chose another

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

new numbersthe test page's numbers

question 3

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

05100510
the answer, and why

the answer is D

It just reaches the farthest of the 4 nearest, the circle at 4, 9: 3 squared plus 2 squared is 13, and its root is about 3.61.

if you chose another

  • That is the second nearest, the triangle at 9, 9.
  • That is the circle at 1, 6, the nearest outside the ring.
  • That is the farthest point of all, the triangle at 3, 1.

new numbersthe test page's numbers