F1 Score

noun

say it: “EF WUN SKOR” /ˈɛf ˈwʌn ˈskɔr/

A score from 0 to 1 that combines a model's precision and recall, high only when both are high.

What is the F1 score?

The F1 score combines precision and recall into one number, their harmonic mean: 2 × P × R / (P + R). It's only high when both are, so a model can't score well by being good at only one, which makes it handy when the positive class is rare.

from sklearn.metrics import f1_score
actual = [1, 0, 0, 1, 1, 0, 0, 0]
guessed = [1, 0, 0, 0, 0, 0, 0, 0]    # precision 1.0, recall 0.333
print(f1_score(actual, guessed))   # 0.5

In a sentence

  • “She compared the two fraud models by their F1 score.”
  • “The F1 score of 0.5 showed that perfect precision couldn't make up for weak recall.”

Level: Journeyman · More AI Basics terms at this level

Updated