What is the Loss function for KNN Regressor? Would it be similar to OLS? If so what would be the main difference?


1 Answer 1


You can use your preferred loss function for regression problems. Mean-squared error (or equivalently, sum of squares) is one of the most commonly used ones, but there are many others depending of the specifics of your problem, in particular, of what counts as a big mistake compared to an acceptable one.

You can find some alternatives to mean-squared error here https://heartbeat.fritz.ai/5-regression-loss-functions-all-machine-learners-should-know-4fb140e9d4b0

Anyway, the fact that you are using KNN-regression instead of any other regression method makes no big difference

  • $\begingroup$ So this is not a classification problem, this would specifically be for KNN Regressor as opposed to KNN Classifier $\endgroup$
    – PastaHo69
    Mar 18, 2019 at 14:07
  • $\begingroup$ Oops, sorry, I read it the other way for some reason. Editting into the right answer in a few minutes $\endgroup$
    – David
    Mar 18, 2019 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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