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

051015-50510
the answer, and why

the answer is D

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

if you chose another

  • That counts only the 3 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 2 across, 9 up, among 8 9 c, 4 6 s, 6 3 s, 0 10 c, 5 3 t and 2 1 s, with k = 4. How many circles are inside the ring?

-50510051015
the answer, and why

the answer is C

The ring of the 4 nearest reaches 6.71 and takes in both circles, at 0, 10 and 8, 9, 2.24 and 6 away.

if you chose another

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

new numbersthe test page's numbers

question 3

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

-505100510
the answer, and why

the answer is B

It just reaches the farthest of the 3 nearest, the circle at 5, 9: 5 squared plus 4 squared is 41, and its root is about 6.4.

if you chose another

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

new numbersthe test page's numbers