Classification Evaluation (Confusion Matrix and Metrics)

Context: FIT1043_MOC Β· how good is a classifier? Β· counts outcomes in a confusion matrix Β· the right metric depends on the cost of each error

Quick Revision

  • 🎯 Objective: score a classifier βž” build a confusion matrix (TP/FP/FN/TN), then compute the metric that matches the task.
  • πŸ“¦ Core Components: accuracy | sensitivity/recall | specificity | precision | false-positive rate.
  • ⚑ Key Constraint: accuracy alone misleads β€” choose the metric by which error is worse (a missed fraud vs a blocked good email).

πŸ“ How It Works

1. The Confusion Matrix

Predicted PositivePredicted Negative
Actual PositiveTP (true positive)FN (false negative)
Actual NegativeFP (false positive)TN (true negative)

2. The Five Metrics

  • Accuracy βž” overall correct: .
  • Sensitivity / Recall βž” of actual positives, how many caught: .
  • Specificity βž” of actual negatives, how many correct: .
  • False Positive Rate βž” of actual negatives, how many wrongly flagged: .
  • Precision βž” of predicted positives, how many correct: .

3. Which Metric When (it depends)

  • Spam filter βž” optimise precision / specificity β€” a FN (spam in inbox) is tolerable; a FP (good mail blocked) is costly.
  • Fraud detector βž” optimise sensitivity/recall β€” a FP (normal flagged) is tolerable; a FN (missed fraud) is costly.
  • Covid test βž” balance sensitivity (catch the sick) vs specificity (don’t alarm the healthy).

βš–οΈ Core Decision Matrix

MetricQuestion it answersFormula
Accuracyoverall how often correct?
Recall (sensitivity)of actual +, how many found?
Specificityof actual βˆ’, how many correct?
Precisionof predicted +, how many right?

When It Flips: recall and precision pull apart β€” flagging everything positive gives perfect recall but poor precision; flagging only sure cases gives high precision but poor recall. The task's error costs pick which to favour.

πŸ“Š Exam Execution Trace

Applied Exercise

Problem: , , , . Compute accuracy, recall, precision. Derivation Proof / Hand-Calculation Walkthrough:

Final Extracted Output: 70% accurate; catches 80% of positives (recall) but only 67% of its positive calls are right (precision).

🧠 Active Recall