Gradient

Courses

∇\nabla∇The maths behind AI0/72
π\piπMaths0/84
⋆\star⋆AI for everyone0/10
Γ\GammaΓGame theory0/49
py\texttt{py}pyPython for AI0/15
y^\hat{y}y^​Build your own AI0/15
All courses

Tuition

My tuitionOlympiad trackCompetitions

Practice

ProjectsAsk a questionTrain on a GPUExplorationsMaths StoriesUnsolved problemsPlaygroundScience labsMock testsOlympiad

Reference

GlossaryBlogDiscoveries
Glossary › Nearest neighbours

What is nearest neighbours?

Finding the stored vectors that are closest to a given one. Used to classify by example, to search and to recommend.

Where it is taught

Distance and nearest neighbours. If things are vectors, then "similar" means "close". Measuring closeness gives the simplest learning method there is, and the one behind search by meaning.

What the lesson leaves you with

  • Distance is the length of the difference between two vectors.
  • k nearest neighbours labels a point by a vote among the kkk closest examples.
  • Small kkk is jumpy, large kkk is blurry, and everything depends on good vectors.
Open the lesson

Questions

What is nearest neighbours?
Finding the stored vectors that are closest to a given one. Used to classify by example, to search and to recommend.
Where is nearest neighbours used in AI?
If things are vectors, then "similar" means "close". Measuring closeness gives the simplest learning method there is, and the one behind search by meaning.
What is the key idea to remember about nearest neighbours?
Distance is the length of the difference between two vectors.
Where can I learn nearest neighbours step by step?
In the lesson “Distance and nearest neighbours” in Gradient’s course on the maths behind AI, with interactive diagrams and questions.

See it in 3D on the blog

  • Where is clustering used in real life?3 min

Related terms

  • Cosine similarity
  • Dot product
  • Embedding
  • Parameter
  • Vector