I am using scikit-learn's KNN regressor to fit a model to a large dataset with n_neighbors = 100-500
. Given the nature of the data, some parts (think: sharp delta-function like peaks) are better fit with fewer neighbors (n_neighbors ~ 20-50
) so that the peaks are not smoothed out. The location of these peaks are known (or can be measured).
Is there a way to vary the n_neighbors
parameter?
I could fit two models and stitch them together, but that would be inefficient. It would be preferable to either prescribe 2-3 values for n_neighbors
or, worse, send in an list of n_neighbors
.