What it does

KNN looks at the closest examples and copies the group most of them belong to.

K: Number of neighbors • Proximity: How close items are

How it works

  • Put the new item on a map with old examples.
  • Find the closest neighbors.
  • Give the new item the label most nearby neighbors have.

Uses & Applications

  • A music app can find songs similar to songs you already like.
  • A photo app can group a new picture with similar pictures.
  • A store can suggest products close to what you bought before.
In short

Nearby things are often alike, like “birds of a feather flock together.”

Try it yourself

Ask the nearest dots

A new dot needs a team. It asks nearby colored dots which team to join.

Your turn

Change one setting at a time. Reset example puts everything back.

Let nearby points vote

Step 1
Why this happens

Look closer at the numbers
Numbers used in this example