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

-50510-50510
the answer, and why

the answer is A

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

new numbersthe test page's numbers

question 2

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

-50510051015
the answer, and why

the answer is C

The ring of the 4 nearest reaches 7.07 and takes in both circles, at 2, 10 and 3, 5, 2 and 3.16 away.

if you chose another

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

new numbersthe test page's numbers

question 3

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

0510150510
the answer, and why

the answer is C

It just reaches the farthest of the 5 nearest, the square at 8, 5: 2 squared plus 4 squared is 20, and its root is about 4.47.

if you chose another

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

new numbersthe test page's numbers