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

051015051015
the answer, and why

the answer is C

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

new numbersthe test page's numbers

question 2

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

05100510
the answer, and why

the answer is C

The ring of the 3 nearest reaches 3.61 and takes in both circles, at 3, 10 and 0, 7, 1 and 3.61 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 5 across, 9 up, among 10 6 s, 1 0 t, 6 9 t, 5 2 c and 7 8 t, with k = 3. How far does the ring reach?

0510051015
the answer, and why

the answer is A

It just reaches the farthest of the 3 nearest, the square at 10, 6: 5 squared plus 3 squared is 34, and its root is about 5.83.

if you chose another

  • That is the second nearest, the triangle at 7, 8.
  • That is the circle at 5, 2, the nearest outside the ring.
  • That is the farthest point of all, the triangle at 1, 0.

new numbersthe test page's numbers