2
$\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
$\begingroup$

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

| improve this answer | |
$\endgroup$
0
$\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.

| improve this answer | |
$\endgroup$
  • 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 '19 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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