avoid infinite weights in kNN regression

Same issue as https://github.com/scikit-learn/scikit-learn/pull/2941, but in the regressor instead of the classifier.