Skip to main content

K-Nearest Neighbors (KNN)

·86 words·1 min

The k-nearest neighbors (KNN) algorithm is a non-parametric, supervised learning classifier, which uses proximity to make classifications or predictions about the grouping of an individual data point. It is one of the popular and simplest classification and regression classifiers used in machine learning today.

  • typically used as a classification algorithm teste

hyperparameter K (K): number of neighbors

N: number of samples in the dataset

practical rule: $$ K = \sqrt{N} $$

Euclidian Distance: $$ d(p, q) = \sqrt{\sum_{i=1}^{n} (q_i - p_i)^2} $$

Precisian and Recall: ![[Precisionrecall.png]]