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

-505100510
the answer, and why

the answer is A

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

new numbersthe test page's numbers

question 2

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

05100510
the answer, and why

the answer is B

The ring of the 4 nearest reaches 6.4 and takes in both circles, at 7, 1 and 9, 2, 2 and 2.24 away.

if you chose another

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

new numbersthe test page's numbers

question 3

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

05100510
the answer, and why

the answer is D

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

if you chose another

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

new numbersthe test page's numbers