Nearest neighbors regression
This section discusses the nearest neighbors regression.
How it works…
Neighbors-based regression can be used in cases where the data labels are continuous, rather than discrete, variables. The label assigned to a query point is computed based on the mean of the labels of its nearest neighbors.
Scikit-learn implements two different neighbors regressors: KNeighborsRegressor
implements learning based on the K nearest neighbors of each query point, where K is an integer value specified by the user. RadiusNeighborsRegressor
implements learning based on the neighbors within a fixed radius r of the query point, where r is a floating-point value specified by the user.
The basic nearest neighbors regression uses uniform weights. That is, each point in the local neighborhood contributes uniformly to the classification of a query point. Under some circumstances, it can be advantageous to weigh points such that nearby points contribute more to the regression than faraway points...