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

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

-50510051015
the answer, and why

the answer is D

The ring of the 4 nearest reaches 6.08 and takes in both circles, at 5, 10 and 3, 3, 3.61 and 5.1 away.

if you chose another

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

new numbersthe test page's numbers

question 3

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

-505100510
the answer, and why

the answer is C

It just reaches the farthest of the 5 nearest, the square at 8, 7: 7 squared plus 2 squared is 53, and its root is about 7.28.

if you chose another

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

new numbersthe test page's numbers