liveBook · Manning

F-score

As explained in Grokking Machine Learning, Second Edition

The F-score obtained when the beta weighting parameter equals one, giving precision and recall equal weight.

The F-score evaluates a classification model when both kinds of mistakes matter: false positives and false negatives. It combines precision, which asks how many predicted positives are correct, with recall, which asks how many actual positives were found. section 7.9 section 7.18

The usual F-score is the F1-score. It is the harmonic mean of precision and recall: F1 = 2 × precision × recall ÷ (precision + recall). Unlike an ordinary average, it stays close to the smaller value, so one weak metric lowers the result. section 7.10

Use the F1-score when:

  • You want one measure that rewards models only when both precision and recall are high. section 7.10
  • Accuracy hides important errors, especially when positive and negative labels are unbalanced. section 7.4
  • Both false positives and false negatives matter, but neither requires extra weighting. section 7.9

Medical diagnosis and spam filtering

A medical model may need strong recall so it misses few sick people, while a spam filter may need strong precision so it does not delete good emails. The F1-score is appropriate when both goals still matter together; use Fβ-score instead when one deserves more weight. section 7.10 section 7.11

Use the equation view to connect the harmonic-mean idea with the F-score calculation. section 7.10

How Grokking Machine Learning, Second Edition covers it

How deep it goes
Defines F1 as a harmonic mean and explains why a low precision or recall lowers it.
Examples
Uses coronavirus diagnosis, spam filtering, recommendations, and pedestrian detection to compare precision-recall priorities.
What it assumes
Assumes basic classification awareness while defining precision, recall, false positives, and false negatives.
What you can do after
Evaluate classification models with F1 and choose Fβ when precision or recall deserves greater importance.
How it connects
Connects precision and recall with false positives, false negatives, confusion matrices, and Fβ-score.

Also explained in

Compare how 20 books explain f-score →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Machine Learning, Second Edition. The section links point to the parts of the book it draws on.