Confusion Matrix

12/06/2025
A confusion matrix is a table used to evaluate the performance of a classification model. It summarizes the predictive results and shows the number of correct and incorrect predictions made by the model. The matrix itself displays the true positives, false positives, true negatives, and false negatives, providing insight into how well the model is performing across different classes.

Our confusion matrix illustrates the performance of a classification model. It clearly shows the rates of:

  • True Positives: Correctly predicted positive observations.
  • False Positives: Incorrectly predicted positive observations.
  • False Negatives: Incorrectly predicted negative observations.
  • True Negatives: Correctly predicted negative observations.

This matrix is a vital tool in understanding how well our model is performing.

Understanding Accuracy, Recall, and Precision

In the realm of data science and machine learning, accuracy, recall, and precision are pivotal metrics that help us gauge the performance of our models. Accuracy is the ratio of correctly predicted instances to the total instances. It gives us an overall effectiveness of the model. The formula for accuracy is: Accuracy = (True Positives + True Negatives) / (Total Instances).

Recall and Precision

Recall, also known as sensitivity, measures the ability of a model to find all the relevant cases (True Positives) in the dataset. The formula is: Recall = True Positives / (True Positives + False Negatives). Precision, on the other hand, quantifies the accuracy of the positive predictions. The formula is: Precision = True Positives / (True Positives + False Positives). Understanding these metrics is essential for evaluating your models comprehensively.

The F1 Score is a measure used in statistical analysis and machine learning that combines precision and recall into a single metric. It is calculated as the harmonic mean of precision and recall, providing a balance between the two metrics. An F1 Score closer to 1 indicates a strong model performance, while a score closer to 0 suggests poor performance. This metric is particularly useful in scenarios where there is an uneven class distribution, such as in binary classification problems.

Understanding F1 Score

The F1 Score is a measure of a test's accuracy that considers both the precision and the recall of the test to compute the score. It is defined as the harmonic mean of precision and recall, providing a balanced measure that is particularly useful when you have an uneven class distribution. The formula for the F1 Score is given by:

F1 Score = 2 × (Precision × Recall) / (Precision + Recall)

40 Multiple Choice Questions (MCQs) based on Confusion Matrix

🔷 Confusion Matrix Basics (Q1–Q10)

Q1. In a binary classification, which component of the confusion matrix represents the correctly predicted positive cases?
A) True Negative
B) False Positive
C) True Positive ✅
D) False Negative
Explanation: True Positive (TP) = predicted positive and actually positive.

Q2. What does a False Negative mean?
A) Model predicted negative, and it's actually negative
B) Model predicted positive, and it's actually negative
C) Model predicted negative, but it's actually positive ✅
D) Model predicted correctly
Explanation: FN = missed positive case.

Q3. Which of the following represents the total number of correct predictions?
A) TP + FP
B) TP + TN ✅
C) TN + FN
D) FP + FN
Explanation: Correct = TP + TN.

Q4. A high number of False Positives affects:
A) Recall
B) Accuracy
C) Precision ✅
D) F1 Score
Explanation: Precision = TP / (TP + FP)

Q5. Which of the following is NOT part of the confusion matrix?
A) True Negative
B) True Positive
C) False Negative
D) True Unknown ✅
Explanation: No "True Unknown" exists in standard matrix.

Q6. A confusion matrix is mostly used to evaluate:
A) Regression models
B) Clustering
C) Classification models ✅
D) Outlier detection
Explanation: It applies to classification performance.

Q7. Which of the following increases Recall?
A) Reducing False Positives
B) Increasing True Positives ✅
C) Reducing True Negatives
D) Increasing False Negatives
Explanation: Recall = TP / (TP + FN)

Q8. If a model predicts all samples as positive, which metric will be highest?
A) Accuracy
B) Precision
C) Recall ✅
D) F1 Score
Explanation: Recall = TP / (TP + FN) → FN = 0 → Recall = 1.

Q9. A confusion matrix of 2x2 is used for:
A) Multi-label classification
B) Binary classification ✅
C) Regression
D) NLP only
Explanation: 2x2 matrix suits binary classification.

Q10. Which value in a confusion matrix indicates Type I error?
A) FN
B) TP
C) FP ✅
D) TN
Explanation: FP = False Positive = Type I error.

🔶 Accuracy (Q11–Q20)

Q11. Accuracy formula is:
A) TP / (TP + FP)
B) TP / (TP + FN)
C) (TP + TN) / Total ✅
D) FP / (FP + TN)
Explanation: Accuracy = correct predictions / total.

Q12. If a model has TP = 80, TN = 10, FP = 5, FN = 5, what is Accuracy?
A) 90% ✅
B) 80%
C) 85%
D) 75%
Explanation: (80+10)/(80+10+5+5) = 90/100 = 90%

Q13. Accuracy can be misleading when:
A) Classes are balanced
B) Model is perfect
C) Dataset is small
D) Dataset is imbalanced ✅
Explanation: Accuracy can hide poor class performance in imbalance.

Q14. If all predictions are wrong, Accuracy is:
A) 1
B) 0 ✅
C) 0.5
D) Cannot say
Explanation: No correct predictions = 0 accuracy.

Q15. What happens to Accuracy if FP and FN both increase?
A) Increases
B) Decreases ✅
C) No change
D) Becomes 100%
Explanation: More errors → less accuracy.

Q16. What is the total sample size in confusion matrix: TP=50, FP=10, FN=5, TN=35?
A) 95
B) 100 ✅
C) 90
D) 85
Explanation: Sum = 50 + 10 + 5 + 35 = 100.

Q17. What is Accuracy if TP=0, TN=100, FP=0, FN=0?
A) 0%
B) 50%
C) 100% ✅
D) Undefined
Explanation: All true negatives, so perfect accuracy.

Q18. High accuracy in fraud detection can still be misleading due to:
A) Data type
B) Imbalanced classes ✅
C) Too many features
D) High recall
Explanation: Fraud cases are rare → imbalance.

Q19. What is the major drawback of Accuracy?
A) Not interpretable
B) Ignores correct predictions
C) Fails in imbalanced data ✅
D) Hard to compute
Explanation: Accuracy doesn't reflect minority class performance.

Q20. A model gives 99% accuracy on 99% class-0 and 1% class-1. It always predicts class-0. Is this good?
A) Yes
B) No ✅
C) Maybe
D) Depends on algorithm
Explanation: Model ignores class-1; bad despite 99% accuracy.

🔶 Precision (Q21–Q30)

Q21. Precision formula is:
A) TP / (TP + FP) ✅
B) TP / (TP + FN)
C) TP / Total
D) TN / Total
Explanation: Measures correctness of positive predictions.

Q22. Precision focuses on:
A) Actual positives
B) Predicted positives ✅
C) Actual negatives
D) False negatives
Explanation: Precision = correct positive predictions among all predicted positive.

Q23. TP = 30, FP = 10. Precision = ?
A) 0.75 ✅
B) 0.66
C) 0.60
D) 0.50
Explanation: 30 / (30+10) = 0.75

Q24. Precision is low when:
A) FP is high ✅
B) TP is high
C) TN is high
D) FN is high
Explanation: More FP lowers precision.

Q25. If precision is 1, what does it imply?
A) No false negatives
B) All predicted positives are true ✅
C) No true positives
D) All actual positives are detected
Explanation: Precision 1 → FP = 0

Q26. Which domain requires high precision most?
A) Disease detection
B) Spam detection ✅
C) Face recognition
D) Weather forecasting
Explanation: Better to avoid false alarms in spam detection.

Q27. Precision penalizes:
A) False Negatives
B) False Positives ✅
C) True Positives
D) True Negatives
Explanation: FP lowers precision.

Q28. If FP = 0, Precision is:
A) 0
B) 0.5
C) 1 ✅
D) Depends
Explanation: TP / (TP + 0) = 1

Q29. High precision implies:
A) Few FP ✅
B) Many FN
C) Many TN
D) Many FP
Explanation: Precision inversely proportional to FP.

Q30. Which metric is best when cost of false positive is high?
A) Recall
B) Precision ✅
C) Accuracy
D) Specificity
Explanation: Avoiding FP is key when it's costly.

🔶 Recall (Q31–Q40)

Q31. Recall formula is:
A) TP / (TP + FN) ✅
B) TP / (TP + FP)
C) TP / Total
D) TP / (TP + TN)
Explanation: Measures coverage of actual positives.

Q32. If TP = 80, FN = 20, recall = ?
A) 0.80
B) 0.90
C) 0.85
D) 0.80 ✅
Explanation: 80 / (80 + 20) = 0.80

Q33. Recall is also called:
A) Sensitivity ✅
B) Specificity
C) Precision
D) F1 Score
Explanation: Recall = Sensitivity = True Positive Rate.

Q34. A high FN affects:
A) Recall ✅
B) Precision
C) Accuracy
D) Specificity
Explanation: More FN → lower recall.

Q35. In medical diagnosis, which is more important?
A) Precision
B) Accuracy
C) Recall ✅
D) Specificity
Explanation: Better to catch all cases, even with some FP.

Q36. Recall is 1 if:
A) TP = 0
B) FN = 0 ✅
C) FP = 0
D) TN = 0
Explanation: FN = 0 → Recall = 1

Q37. If model predicts only positive, recall becomes:
A) High ✅
B) Low
C) Undefined
D) Zero
Explanation: FN = 0 → Recall is high.

Q38. Recall penalizes:
A) False Positives
B) False Negatives ✅
C) True Negatives
D) Precision
Explanation: Recall drops with FN.

Q39. F1 Score is:
A) Average of Precision and Recall
B) Max(Precision, Recall)
C) Harmonic mean of Precision and Recall ✅
D) TP + TN / Total
Explanation: F1 = 2*(P*R)/(P+R)

Q40. When precision = 1 and recall = 0, F1 Score is:
A) 1
B) 0 ✅
C) 0.5
D) Undefined
Explanation: Harmonic mean of 1 and 0 is 0.