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?
Data Science Stack Exchange is a question and answer site for Data science professionals, Machine Learning specialists, and those interested in learning more about the field. It only takes a minute to sign up.
Sign up to join this communityFor 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?
"A good algorithm for varying the number of neighbors" is probably quite data-dependent. But there is, for example, the fixed radius approach.
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.