Machine Learning
Math · Advanced · Lesson 1 of 8

Nearest Neighbours

Guess from the most similar examples

An interactive lesson with 6 steps, about 5 minutes: you predict, drag and solve, with instant feedback on every answer. It runs in your browser and needs JavaScript.

What you’ll learn

  • k-NN predicts by majority vote of the k most similar examples.
  • Small k follows quirks; large k over-smooths.
  • Scale features before measuring distances.

Steps

  1. What kind of fruit?
  2. How far apart?
  3. Ask more neighbours
  4. Too many neighbours
  5. Different units
  6. The cost of remembering