Sobes.tech
Middle

Calculate the F1 score for a model that always predicts 0, given a sample of 90 zeros and 10 ones.

sobes.tech AI

Answer from AI

The model always predicts class 0.

Given:

  • Total 100 objects: 90 zeros (class 0) and 10 ones (class 1).
  • Predictions: all 0.

Let's compute metrics for class 1 (usually F1 is calculated for the positive class):

  • True Positives (TP) = 0 (the model did not predict any 1)
  • False Positives (FP) = 0 (the model did not predict 1, so FP=0)
  • False Negatives (FN) = 10 (all 10 ones are missed)

Precision = TP / (TP + FP) = 0 / 0 — undefined, we consider 0 Recall = TP / (TP + FN) = 0 / 10 = 0

F1 = 2 * (Precision * Recall) / (Precision + Recall) = 0

Result: F1 = 0

If calculated for class 0, then:

  • TP = 90
  • FP = 10 (all ones incorrectly classified as 0)
  • FN = 0

Precision = 90 / (90 + 10) = 0.9 Recall = 90 / (90 + 0) = 1 F1 = 2 * 0.9 * 1 / (0.9 + 1) ≈ 0.947

But F1 is usually calculated for the positive class, so the answer is: F1 = 0.