I am a newbie currently learning data science from scratch and I have a rather stupid question to ask. I’m currently learning about binary classification, and I understand that the logistic function is a useful tool for this. I looked up the documentation and noticed that there are two logistic related functions I can import, i.e. sklearn.metric.log_loss and sklearn.linear_model.LogisticRegression. When and where should I use them, and what’s the difference?

On a broader note, what’s the difference between a metric and a model, and why is the log loss function a metric? Apologies if this question sounds completely nonsensical, but this is a genuine source of confusion for me!

  • 1
    $\begingroup$ I think the answer accepted below is fine, I upvoted it. But since you learn from scratch, maybe a slightly different interpretation can be nice for you. When you are training your model, algorithm tries to minimize your 'cost', which is the sum of the 'losses' or error per sample combined, divided by the number of samples you have. We choose the type of the losses (errors); log_loss is one type as a 'metric'. After training, you get a model that can do predictions, classification/regression/clustering etc. at the end. For 'model' training, you choose your 'metric', depending on your aim. $\endgroup$
    – Ugur MULUK
    Nov 22, 2018 at 11:36

1 Answer 1


The metrics module by Scikit-learn implements functions assessing prediction error for specific purposes (Regression, classification, etc.). Model is the algorithm that actually does the classification/regression/clustering (as per need) for you.

Log-loss measures the accuracy of, say a classifier. It is used when the model outputs a probability for each class, rather than just the most likely class.

EDIT: Thanks to @mapto for suggesting documentation reference:

  • $\begingroup$ Welcome to the site, both of you. It might be useful to refer to the actual documentation of both log-loss and LogisticRegression in scikit-learn. $\endgroup$
    – mapto
    Nov 22, 2018 at 9:15
  • $\begingroup$ Thanks @mapto! I've made necessary changes in my answer. $\endgroup$ Nov 22, 2018 at 10:06

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.