A user tried the following code for KNN and obtained 100

935    Asked by NaveenYadav in Data Science , Asked on Nov 4, 2019
Answered by Nitin Solanki

KNN does not produce wrong results all the time. It largely depends on the dataset. There might be two reasons for this error.

The training data might be equal to the testing data so it is efficient in all cases.

It might be an overfit case which means the mode is not able to capture randomness and hence is predicting with 100% of training data

We can solve this error by splitting the data into different ratio for training and testing. Also we can try several tuning parameters for model selection.



Your Answer

Interviews

Parent Categories