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

05100510
the answer, and why

the answer is C

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

05100510
the answer, and why

the answer is B

The ring of the 4 nearest reaches 5.83 and takes in both circles, at 8, 10 and 1, 6, 2.83 and 5.39 away.

if you chose another

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

new numbersthe test page's numbers

question 3

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

051015051015
the answer, and why

the answer is B

It just reaches the farthest of the 4 nearest, the circle at 9, 2: 3 squared plus 8 squared is 73, and its root is about 8.54.

if you chose another

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

new numbersthe test page's numbers