Skip to main content

Envisioning is an emerging technology research institute and advisory.

LinkedInInstagramGitHub

2011 — 2026

research
  • Reports
  • Newsletter
  • Methodology
  • Origins
  • Vocab
services
  • Research Sessions
  • Signals Workspace
  • Bespoke Projects
  • Use Cases
  • Signal Scanfree
  • Readinessfree
impact
  • ANBIMAFuture of Brazilian Capital Markets
  • IEEECharting the Energy Transition
  • Horizon 2045Future of Human and Planetary Security
  • WKOTechnology Scanning for Austria
audiences
  • Innovation
  • Strategy
  • Consultants
  • Foresight
  • Associations
  • Governments
resources
  • Pricing
  • Partners
  • How We Work
  • Data Visualization
  • Multi-Model Method
  • FAQ
  • Security & Privacy
about
  • Manifesto
  • Community
  • Events
  • Support
  • Contact
  • Login
ResearchServicesPricingPartnersAbout
ResearchServicesPricingPartnersAbout
  1. Home
  2. Vocab
  3. kNN (k-Nearest Neighbors)

kNN (k-Nearest Neighbors)

A non-parametric algorithm that classifies points by majority vote of their nearest neighbors.

Year: 1967Generality: 796
Back to Vocab

k-Nearest Neighbors (kNN) is one of the most intuitive algorithms in machine learning, operating on a deceptively simple principle: to classify or predict a value for a new data point, find the k most similar examples in the training set and let them vote. In classification tasks, the new point inherits the majority class among its k neighbors; in regression, it receives the average of their output values. The algorithm is entirely non-parametric, meaning it makes no assumptions about the underlying data distribution — the training data itself serves as the model.

The mechanics of kNN hinge on two key choices: the value of k and the distance metric used to define "nearness." Common metrics include Euclidean distance (straight-line distance in feature space), Manhattan distance (sum of absolute differences), and Hamming distance (useful for categorical data). A small k makes the model sensitive to noise and prone to overfitting, while a large k smooths decision boundaries but risks underfitting. Selecting the right k typically involves cross-validation. Because kNN stores the entire training dataset and defers all computation to query time, it is classified as a lazy learner — there is no explicit training phase, but prediction can be slow and memory-intensive for large datasets.

Despite its simplicity, kNN remains practically relevant and theoretically important. It is often used as a baseline model, for anomaly detection, and in recommendation systems. Its performance degrades in high-dimensional spaces — a phenomenon known as the curse of dimensionality — where distances between points become increasingly uniform, making "nearness" meaningless. Dimensionality reduction techniques like PCA are frequently applied as preprocessing steps to mitigate this.

kNN also serves as a conceptual anchor for understanding more sophisticated algorithms. Its decision boundaries are inherently local and non-linear, offering a useful contrast to linear models. Approximate nearest neighbor methods (e.g., KD-trees, ball trees, FAISS) have extended kNN's scalability, keeping it relevant even as dataset sizes have grown dramatically in the modern deep learning era.

Related

Related

Kernel Method
Kernel Method

Algorithms that implicitly map data into high-dimensional spaces using kernel functions.

Generality: 796
Clustering
Clustering

An unsupervised learning technique that groups similar data points together automatically.

Generality: 838
Similarity Computation
Similarity Computation

Quantifying how alike two data objects are to support learning algorithms.

Generality: 709
Support Vector Machine (SVM)
Support Vector Machine (SVM)

A supervised learning model that classifies data by finding the optimal separating hyperplane.

Generality: 720
Similarity Search
Similarity Search

Finding the most similar items to a query within a large dataset.

Generality: 794
Naive Bayes Classifier
Naive Bayes Classifier

A probabilistic classifier assuming all input features are mutually independent given the class.

Generality: 694