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

05100510
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 numbersthe test page's numbers

question 2

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

05100510
the answer, and why

the answer is B

The ring of the 3 nearest reaches 3.16 and takes in both circles, at 8, 1 and 5, 1, 1 and 3.16 away.

if you chose another

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

new numbersthe test page's numbers

question 3

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

0510-50510
the answer, and why

the answer is A

It just reaches the farthest of the 3 nearest, the square at 10, 1: 7 squared plus 0 squared is 49, and its root is about 7.

if you chose another

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

new numbersthe test page's numbers