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

02468100246810
the answer, and why

the answer is D

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

new numbers

question 2

On the same points, how many circles are inside the ring?

02468100246810
the answer, and why

the answer is C

The 3 nearest are the circles at 6, 2 and 3, 2, 2.24 and 2.83 away, and the square at 8, 5, 3.16 away.

if you chose another

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

new numbers

question 3

On the same points, how far does the ring reach?

02468100246810
the answer, and why

the answer is D

It just reaches the farthest of the 3 nearest, the square at 8, 5, 3 across and 1 up, the root of 10.

if you chose another

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

new numbers