k-NN (EN)
Termk-Nearest-Neighbor algorithm for classification based on neighborhood
k-NN Algorithm
The k-Nearest Neighbor (k-NN) algorithm is a simple but effective learning algorithm for classification and regression tasks. It classifies data points based on the classes of the k nearest neighbors in the feature space. The number of neighbors (k) is an important parameter that influences the complexity and accuracy of the model. k-NN is a so-called 'lazy learner' as it does not perform an explicit training phase, but rather performs all calculations at prediction time.
Architecture
flowchart TD A[Data point] --> B[Distance calculation] B --> C{Find k-neighbors} C --> D[Classification/Regression] D --> E[Prediction] In Context
- Typically used together with metrics such as Euclidean distance or Manhattan distance
- Related to: Lazy Learning, Instance-Based Learning, Feature Engineering
- Example use: Image recognition, recommendation systems, anomaly detection