Solved – Python kNN vs. radius nearest neighbor regression

k nearest neighbourmachine learningpythonregression

Python offers two nearest neighbor regressions: radius nearest neighbor and k-nearest neighbor. I'm trying to figure out a few things:
1. Under which circumstances would each be preferable?
2. How do you approach setting the optimal radius or k value?

For reference, I'm working with a relatively sparse data set with a uniform geometry. As time passes, that dataset will get less sparse, but will continue to have a relatively uniform geometry.

Thanks for any help.

Best Answer

  1. Under which circumstances would each be preferable?

You should try each on your dataset to be sure.

  1. How do you approach setting the optimal radius or k value?

You optimize this value to give you the best results on the training set. Then, you report the performance it gives you on the test set.

For example, train on a 90% random partition of your data. Use the remaining 10% to test the value you have chosen. You can also use 5 folds cross validation if you want a better way to assess the performance of your classifier.

Related Question