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

051015-50510
the answer, and why

the answer is D

One for each of the 6 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 6 are measured.

new numbersthe test page's numbers

question 2

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

-505100510
the answer, and why

the answer is B

The ring of the 7 nearest reaches 7.81 and takes in both circles, at 1, 7 and 8, 4, 1 and 7.28 away.

if you chose another

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

new numbersthe test page's numbers

question 3

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

0510-50510
the answer, and why

the answer is D

It just reaches the farthest of the 4 nearest, the triangle at 10, 7: 5 squared plus 5 squared is 50, and its root is about 7.07.

if you chose another

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

new numbersthe test page's numbers