## Machine Learning Lesson of the Day – K-Nearest Neighbours Regression

February 28, 2014 5 Comments

I recently introduced the K-nearest neighbours classifier. Some slight adjustments to the same algorithm can make it into a regression technique.

Given a training set and a new input , we can predict the target of the new input by

- identifying the K data (the K “neighbours”) in the training set that are closest to by
**Euclidean distance** - build a linear regression model to predict the target for

- the K data are the predictors
- the reciprocals of the predictors’ distances to are their respective regression coefficients (the “weights”)

Validation or cross-validation can be used to determine the best number of “K”.

## Recent Comments