Skip to main content
K-Nearest Neighbors Regressor finds the K training examples closest to the input and returns their average target value.

Configuration

ParameterDescriptionDefault
N NeighborsNumber of neighbors to consider.5
Weightsuniform — simple average. distance — weighted by inverse distance.uniform
MetricDistance metric: minkowski, euclidean, manhattan, chebyshevminkowski
PPower for minkowski. p=1 = Manhattan, p=2 = Euclidean.2

Input / Output

Type
InputX Train + Y Train
OutputTrained Model

When to use

Simple baseline that works well on small datasets. Always scale features before KNN.