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

05100510
the answer, and why

the answer is D

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

new numbersthe test page's numbers

question 2

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

-50510051015
the answer, and why

the answer is D

The ring of the 5 nearest reaches 9.85 and takes in both circles, at 0, 7 and 10, 3, 1 and 9.85 away.

if you chose another

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

new numbersthe test page's numbers

question 3

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

-50510051015
the answer, and why

the answer is B

It just reaches the farthest of the 3 nearest, the triangle at 6, 7: 6 squared plus 1 squared is 37, and its root is about 6.08.

if you chose another

  • That is the second nearest, the square at 5, 10.
  • That is the circle at 5, 3, the nearest outside the ring.
  • That is the farthest point of all, the triangle at 9, 1.

new numbersthe test page's numbers