Introduction
The confusion matrix holds four numbers. That's informative but hard to compare between models. Precision and recall squeeze it into two numbers, each answering a simple question about the positive class:
- Precision: When the model raises an alarm, how often is it right?
- Recall: Of all the real cases, how many does the model catch?
Think of a fishing net:
- Recall is how many of the fish in the lake you caught.
- Precision is how much of what's in your net is actually fish (rather than boots and plastic bags).
A huge net catches nearly every fish (high recall) but also lots of junk (low precision). A tiny, careful net brings up almost only fish (high precision) but misses most of them (low recall).
We'll keep using the spam filter from topic 2.1:
| Predicted: ham | Predicted: spam | |
|---|---|---|
| Actual: ham | TN = 830 | FP = 20 |
| Actual: spam | FN = 30 | TP = 120 |