I'm looking to use the k-Nearest Neighbors (kNN) algorithm. What are the possible methods for determining the best K? From what I have read, looking at many different values(say 10-100) should work, but that's a big range.

How can I reduce the range of possible K's I should test?

  • $\begingroup$ Don't you mean k? $\endgroup$ – DuttaA Aug 15 '18 at 5:58
  • $\begingroup$ You could use GridSerchCV, RandomSearchCV, or BayesianOptimization to find the best hyperparameters if you are using Python $\endgroup$ – ebrahimi Aug 15 '18 at 6:13
  • 1
    $\begingroup$ The K in kNN is a hyperparameter. You should look for: how to optimize a hyperparameter. $\endgroup$ – Bruno Lubascher Aug 15 '18 at 8:03
  • $\begingroup$ how do you tune any ML algorithm? Do a grid search on a small subset of the data in question. $\endgroup$ – Mohammad Athar Aug 15 '18 at 14:25
  • $\begingroup$ ebrahimi and Mohammad Athar those both sound like answers not comments. If you post it as an answer then others can vote it up in agreement $\endgroup$ – kbrose Aug 15 '18 at 16:14