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

051015051015
the answer, and why

the answer is D

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

new numbersthe test page's numbers

question 2

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

-505100510
the answer, and why

the answer is D

The ring of the 5 nearest reaches 6.08 and takes in both circles, at 1, 1 and 1, 0, 4.12 and 5.1 away.

if you chose another

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

new numbersthe test page's numbers

question 3

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

05100510
the answer, and why

the answer is A

It just reaches the farthest of the 4 nearest, the triangle at 5, 9: 2 squared plus 5 squared is 29, and its root is about 5.39.

if you chose another

  • That is the second nearest, the circle at 4, 2.
  • That is the square at 8, 8, the nearest outside the ring.
  • That is the farthest point of all, the triangle at 10, 6.

new numbersthe test page's numbers