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

0510150510
the answer, and why

the answer is C

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

if you chose another

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

new numbersthe test page's numbers

question 2

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

-50510051015
the answer, and why

the answer is B

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

if you chose another

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

new numbersthe test page's numbers

question 3

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

051015051015
the answer, and why

the answer is A

It just reaches the farthest of the 6 nearest, the square at 2, 7: 7 squared plus 3 squared is 58, and its root is about 7.62.

if you chose another

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

new numbersthe test page's numbers