The formula for F1 harmonic mean F1 score is
$$ F1 =2*\frac{precision*recall}{precision + recall} $$
The values under the column F1 don't agree with the formula. Any answers
Data Science Stack Exchange is a question and answer site for Data science professionals, Machine Learning specialists, and those interested in learning more about the field. It only takes a minute to sign up.
Sign up to join this communityThe formula for F1 harmonic mean F1 score is
$$ F1 =2*\frac{precision*recall}{precision + recall} $$
The values under the column F1 don't agree with the formula. Any answers
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.