3
$\begingroup$

For nearest-neighbors regression, it is plausible to increase the number of neighbors used to predict $f(x)$ when there are many data points near $x$.

What is a good algorithm for varying the number of neighbors used?

$\endgroup$
1

2 Answers 2

2
$\begingroup$

"A good algorithm for varying the number of neighbors" is probably quite data-dependent. But there is, for example, the fixed radius approach.

$\endgroup$
1
$\begingroup$

The most common method that's used is "The Elbow Method." You decide your neighbours based on the error rate. You can use GridSearch to determine the ideal number of neighbours to be used. This gives you an overview on how to do it.

$\endgroup$
1
  • 2
    $\begingroup$ As I tried to convey in my question, I don't want to used a fixed k for all data points but to vary k based on the density of data points. $\endgroup$
    – Fortranner
    Sep 9, 2019 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.