Machine Learning Basics
A two-class classification model was evaluated on 200 test samples, giving TP = 20, FP = 5, FN = 30 and TN = 145. Which is closest to the F1 score?
- A0.40
- B0.53
- C0.60
Show answer and explanation
Answer: B. 0.53
First, precision is 20 ÷ (20 + 5) = 0.8 and recall is 20 ÷ (20 + 30) = 0.4. The F1 score is the harmonic mean of precision and recall: 2 × 0.8 × 0.4 ÷ (0.8 + 0.4) = 0.64 ÷ 1.2 ≈ 0.53. The harmonic mean is pulled toward the smaller value, so the F1 score is not high when only one of the two is high. Note that the accuracy, (20 + 145) ÷ 200 = 0.825, looks high, yet this model misses 60% of the positives.
- A. This is the recall.
- B. Correct. 2 × 0.8 × 0.4 ÷ 1.2 ≈ 0.53.
- C. This is the arithmetic mean of precision and recall, (0.8 + 0.4) ÷ 2 = 0.6. The F1 score uses the harmonic mean.