Varying the number of neighbors in nearest-neighbors regression 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?
"A good algorithm for varying the number of neighbors" is probably quite data-dependent. But there is, for example, the fixed radius approach.