0
$\begingroup$

I am training my first ever ML classifier, as a final project from an online course I am doing. The first task is to use K Nearest Neighbour to predict if a customer will return a loan or not. I used cross validation to find the optimum K (which turned out to be K=47). Using the default parameters of KNeighborsClassifier, I got an accuracy of 74 and 78% for the training and testing set, respectively (estimated using metrics.accuracy_score). Changing the test/train split to 10% (from 20%) I got 73 and 83% accuracy. From here, I attempted changing KNeighborsClassifier parameters to increase the accuracy for both testing and training set, however, surprisingly anything I do results in absolutely zero change in the accuracy (which is quotes to like .. 10 decimal places). I tried changing the algorithm Most recources I found focus exclusively on tuning the k-number, so I did not find anything answering my question specifically for K Nearest Neighbours.

$\endgroup$
2
  • $\begingroup$ Which other parameters did you attempt to change? Are they just parameters describing how the algorithm is gonna find the solution (which in principle should give the same solution up to some small calculational difference)? Or are there different parameters like the type of distance metric (which does change the solution)? $\endgroup$ Apr 27 '20 at 19:46
  • $\begingroup$ @SextusEmpiricus Ah actually I was changing the algorithm from auto to ball_tree and kd_tree. It makes sense since it just computes the nearest neighbours, the actual predictions should not change. Thank you! I managed to increase the accuracy by changing the weights to 'distance', but this was purely guess work. $\endgroup$
    – Isquare1
    Apr 27 '20 at 21:17
0
$\begingroup$

Which other parameters did you attempt to change?

  • Are they just parameters describing how the algorithm is gonna find the solution?
  • Or are there parameters like the type of distance metric?

The first type of parameters are only changing the method of computing the same solution (but with different speed/efficiency in finding that solution). They should in principle give the same solution up to some small difference due to the calculations (e.g. round off errors point of stopping, etc.)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.