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

0510150510
the answer, and why

the answer is B

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

if you chose another

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

new numbersthe test page's numbers

question 2

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

-50510-50510
the answer, and why

the answer is C

The ring of the 5 nearest reaches 8.06 and takes in both circles, at 0, 5 and 3, 7, 5.83 and 7 away.

if you chose another

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

new numbersthe test page's numbers

question 3

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

0510150510
the answer, and why

the answer is A

It just reaches the farthest of the 4 nearest, the circle at 3, 1: 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, 4.
  • That is the square at 3, 0, the nearest outside the ring.
  • That is the farthest point of all, the triangle at 1, 2.

new numbersthe test page's numbers