Classification - Confusion Matrix & Metrics

3 important questions on Classification - Confusion Matrix & Metrics

Draw and label the confusion matrix for binary classification.

Predicted PositivePredicted NegativeActual PositiveTrue Positive (tp)False Negative (fn) — Type II errorActual NegativeFalse Positive (fp) — Type I errorTrue Negative (tn)
  • Type I error (False Positive): said yes, was no
  • Type II error (False Negative): said no, was yes

Write the formulas for Accuracy, Error Rate, Precision, Recall, and False-Positive Rate.


  • Accuracy = (tp + tn) / (tp + fp + fn + tn)
  • Error Rate = (fp + fn) / (tp + fp + fn + tn) = 1 − Accuracy
  • Precision = tp / (tp + fp)
  • Recall (TPR) = tp / (tp + fn)
  • False-Positive Rate (FPR) = fp / (fp + tn)

What is the F1-score (F-measure)? What problem does it solve?

The F1-score is the harmonic mean of precision and recall:
F1 = (2 · Precision · Recall) / (Precision + Recall)
It solves the problem that precision and recall trade off against each other. A model that achieves high precision by rarely predicting "positive" will have low recall, and vice versa. The F1-score penalises extreme imbalance — it is high only when both precision and recall are high.

The question on the page originate from the summary of the following study material:

  • A unique study and practice tool
  • Never study anything twice again
  • Get the grades you hope for
  • 100% sure, 100% understanding
Remember faster, study better. Scientifically proven.
Trustpilot Logo