# kNN vs Logistic Regression

Good day, I had this question set as optional homework and wanted to ask for some input.

Suppose an individual was to take a data set, divide it in half into training and test data sets and then try out two different classification procedures.

First they use logistic regression and get an error rate of 20% on the training data and 30% on the test data. Next they use 1-nearest neighbours and get an average error rate (average over both test and training data sets) of 18%. According to these numbers, which method would you prefer to use for classification purposes (of new observations)? Why?

I am inclined to say kNN as it is a rather flexible approach and provides a lower error on average. But this doesnt sound formal enough and may likely be a flawed and naive conclusion. Any input?

• It is also a non-parametric approach which is good as it does not assume a shape of the distribution like logistic regression. The drawback that I can see is that it does not tell us which predictors are important. – ʎpoqou Oct 12 '19 at 14:17
• it depends - unless there is a time performance issue I would go for kNN, although if in this question has a catch it might be in a way author came up with kNN avg er 18%... – quester Oct 12 '19 at 14:44

## 2 Answers

Hint: what's the error rate of 1-nearest-neighbor on any training set?

From there, determine the test error on this dataset.

K-nearest_neighbors wiki

As the size of training data set approaches infinity, the one nearest neighbour classifier guarantees an error rate of no worse than twice the Bayes error rate (the minimum achievable error rate given the distribution of the data).

I don't like that they didn't give the error rate for both in the KNN they gave the average error rate. Which makes me think what if the accuracy of the training data was 95% accurate for the training data but the test accuracy was so bad it ended up being 18% error on average for both.

Maybe they want you to think 30-20=10 10*2=20 20>18