Precision vs Recall
The fundamental tradeoff when evaluating a classifier: is it worse to raise a false alarm, or to miss a true event?
Verdict: It depends entirely on the cost of making a mistake. High Precision avoids false alarms. High Recall avoids missing the target.
The Short Answer
When a classification model makes a mistake, it can make two very different types of mistakes: a False Positive (False Alarm) or a False Negative (Missed it).
- Precision cares about False Positives. It asks: "When the model says something is positive, how often is it actually right?"
- Recall cares about False Negatives. It asks: "Out of all the actual positive things in reality, how many did the model successfully find?"
You usually cannot maximize both. If you want to catch every single bad guy (100% Recall), you will inevitably arrest some innocent people (low Precision). If you want to be absolutely sure you only arrest guilty people (100% Precision), you will inevitably let some bad guys go (low Recall).
Where They Differ
| Feature | Precision | Recall |
|---|---|---|
| Formula | TP / (TP + False Positives) | TP / (TP + False Negatives) |
| Also known as | Positive Predictive Value | Sensitivity, True Positive Rate (TPR) |
| Primary Enemy | The False Alarm (False Positive). | The Missed Event (False Negative). |
| How to increase it | Raise the prediction threshold (only trigger if 99% sure). | Lower the prediction threshold (trigger if even 1% sure). |
Choose to optimize A When
(When to optimize Precision)
You optimize Precision when a False Positive is very expensive or dangerous.
- Email Spam Filters: If a real email from your boss goes to the Spam folder (False Positive), that is disastrous. You would rather see a few spam emails in your inbox (False Negative) than miss a critical real email.
- Automated stock trading: If the model predicts "Buy" and is wrong (False Positive), you lose a million dollars. If it misses a good opportunity (False Negative), you just don't make money, which is safer.
- YouTube Recommendations: If it recommends a terrible video (False Positive), the user leaves the site.
Choose to optimize B When
(When to optimize Recall)
You optimize Recall when a False Negative is very expensive or dangerous.
- Cancer Detection: If the model says a patient is healthy when they actually have cancer (False Negative), the patient could die. It is much better to flag a suspicious spot (False Positive) and have a human doctor rule it out.
- Fraud Detection: If a bank misses a fraudulent $10,000 transaction (False Negative), they lose the money. It's better to temporarily freeze a legitimate card (False Positive) and text the user to verify.
- Nuclear Plant Meltdown Alarms: You absolutely cannot miss a real meltdown (False Negative).
What People Get Wrong
Using Accuracy on Imbalanced Data
Beginners often use "Accuracy" (Total Correct / Total Guesses) as their only metric. If you are predicting credit card fraud, and only 1 in 10,000 transactions is fraudulent, a model that simply predicts "Not Fraud" every single time will be 99.99% accurate. But its Recall is 0%, making it completely useless for the business. Always look at Precision and Recall.