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?

  1. A0.40
  2. B0.53
  3. 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.
Practice this topic Back to topic

Related calculators

Books on Machine Learning Basics Ad

As an Amazon Associate I earn from qualifying purchases.

More Machine Learning Basics questions

  1. Which of the following correctly describes the ROC curve and AUC used to evaluate two-class classification models?
  2. For data of 1000 items of which only 10 are positive, what is the accuracy of a model that predicts every item as negative?
  3. Four data points have actual values 3, 5, 2 and 6, and the model predicts 2, 5, 4 and 4 for them. What is the mean squared error (MSE)?
  4. A straight line y = ax + b is fitted by least squares to the three data points (x, y) = (1, 3), (2, 4) and (3, 8). What is the predicted value at x = 4?
  5. In logistic regression, z = 2x − 4 is passed through the sigmoid function σ(z) = 1 ÷ (1 + e^(−z)) and the result is output as the probability of being positive. What is the output when x = 2?