Beginner · Data
K-nearest neighbors
Visual diagram · (in preparation) · Math · (in preparation) · Worked example · 3 difficulty levels.
TL;DR. K-Nearest Neighbors (KNN) is a supervised learning algorithm used for classification and regression that predicts a data point's class based on its nearest neighbors.
Technical Definition
K-Nearest Neighbors (KNN) is a supervised learning algorithm used for classification and regression that predicts a data point's class based on its nearest neighbors.
How it works
K-Nearest Neighbors (KNN) is a simple non-parametric algorithm used in machine learning for both classification and regression tasks. It classifies a new data point based on the majority class of its 'k' nearest neighbors in the feature space. For regression, it predicts the average value of its 'k' nearest neighbors.
Related Concepts
- Classification — A supervised learning task where the model assigns inputs to discrete categories.
- Regression — A supervised learning task that predicts a continuous numeric value.
- Supervised Learning — Learning from input–output pairs where each training example carries a correct label.