The formula for F1 harmonic mean F1 score is F1 =2*(precision*recall)/(precision + recall). enter image description here

The values under the column F1 don't agree with the formula. Any answers

  • Please provide your calculation. It seems everything is fine – Daniel Chepenko Jun 22 at 6:39
  • Lets take the example of Logistic regression F1=2*(0.831*0.811)/(0.831+0.811)=0.8208. The value given under F1 is 0.788 – Arvind Prasad Jun 22 at 7:45
  • 1
    I had posted this question as a bug. It was address. The calculations are okay. The values that we see are the average of F1 for Y and N responses. – Arvind Prasad Jun 27 at 13:51

It is not a bug just weighted averaging is used in computing F1, precision or recall. That means that score is computed per each label/class and then averaged. See the documention by sklearn.

In case of the classifier with 3 classes, the F1 score is computed for class 1 as a target class using the rule you wrote, class 2 as a target class and class 3 as a target class. Those scores are then averaged to retrieve the final score. Recall and precision are computed the same way, all of them are averaging over class scores. The rule you wrote is used in per class calculation but it does not hold for averages.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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