5
$\begingroup$

enter image description here

As you can see, it is about a binary classification with linearSVC. The class 1 has a higher precision than class 0 (+7%), but class 0 has a higher recall than class 1 (+11%). How would you interpret this? And 2 other questions: what does "support" stand for? the precision and recall scores in the classification report are different compared to my results of sklearn.metrics.precision_score or recall_score, why is that so? :/

$\endgroup$
3
$\begingroup$

The classification report is about key metrics in a classification problem.

You'll have precision, recall, f1-score and support for each class you're trying to find.

  • The recall means "how many of this class you find over the whole number of element of this class"

  • The precision will be "how many are correctly classified among that class"

  • The f1-score is the harmonic mean between precision & recall

  • The support is the number of occurence of the given class in your dataset (so you have 37.5K of class 0 and 37.5K of class 1, which is a really well balanced dataset.

The thing is, precision and recall is highly used for imbalanced dataset because in an highly imbalanced dataset, a 99% accuracy can be meaningless.

I would say that you don't really need to look at these metrics for this problem , unless a given class should absolutely be correctly determined.

To answer your other question, you cannot compare the precision and the recall over two classes. This only means you're classifier is better to find class 0 over class 1.

Precision and recall of sklearn.metrics.precision_score or recall_score should not be different. But as long as the code is not provided, this is impossible to determine the root cause of this.

$\endgroup$
  • $\begingroup$ thanks for the wonderful explanation! :) On the documentation page of precision_score and recall_score, I just saw the parameter average, which has the default value binary, this is surely different than the macro avg or weighted avg from the classification report, right? $\endgroup$ – Enyang Wang Dec 9 '19 at 12:29
  • $\begingroup$ You're welcome ! Yes ! Actually it also looks at class 1 by default so the calculated precision or recall might be respectively equal to 0.84 or 0.75 no ? You can check the calculation of macro & weighted avg on other SO questions as well $\endgroup$ – LaSul Dec 9 '19 at 13:56
  • $\begingroup$ yes it is correct, I can confirm it! You are truly better than the documentation page, because I was confused by the documentation of scikit-learn.. Wow so nice that the confusion is gone now :) thanks!! $\endgroup$ – Enyang Wang Dec 9 '19 at 14:33
  • $\begingroup$ You're welcome :) $\endgroup$ – LaSul Dec 9 '19 at 14:49

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.