Confusion Matrix: A Complete Solved Numerical Example
Scenario: Fraudulent Transaction Detection
The Objective: A bank's fraud detection model was evaluated on 200 recent transactions. The results are recorded below.
Step 1: The Confusion Matrix
Here are the raw results from evaluating the model.Positive Class = Fraudulent | Negative Class = Legitimate
Step 2: Step-by-Step Calculation Breakdown
Here is exactly how each metric was derived using the core confusion matrix formulas.
Accuracy
Out of all predictions, how many were perfectly correct?
Precision
When the AI predicted 'Yes', how often was it actually right?
Recall (Sensitivity)
Out of all the actual 'Yes' cases, how many did the AI successfully find?
F1 Score
The harmonic mean. It forces a balance between Precision and Recall.
Step 3: Evaluation Metrics Summary
Using the values above, we calculate the four primary performance metrics for this classification model.
Final Takeaway
The positive class represents a Fraudulent transaction. A False Negative (missed fraud) is significantly more costly than a False Positive (a legitimate transaction flagged for review). With FN=10 and FP=15, this dataset is specifically designed to produce a Precision and Recall that are not equal, forcing students to calculate and interpret the F1 Score as a harmonic mean rather than a simple average.