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

0510051015
the answer, and why

the answer is A

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

new numbersthe test page's numbers

question 2

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

-50510-50510
the answer, and why

the answer is A

The ring of the 3 nearest reaches 6.4 and takes in both circles, at 3, 0 and 7, 3, 1.41 and 5.39 away.

if you chose another

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

new numbersthe test page's numbers

question 3

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

0510-50510
the answer, and why

the answer is C

It just reaches the farthest of the 5 nearest, the triangle at 9, 6: 5 squared plus 6 squared is 61, and its root is about 7.81.

if you chose another

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

new numbersthe test page's numbers