Precision vs. Recall: The Classifier's Trade-off
Precision is the quality of your positive predictions; Recall is the quantity you find. A spam filter with high precision avoids false alarms, while high recall catches most spam.
WHY IT EXISTS Simple accuracy can be dangerously misleading on imbalanced datasets. If a model screens for a rare disease (0.1% of the population) and predicts "no disease" every time, it's 99.9% accurate but completely useless. Precision and Recall were developed to provide a more nuanced view of a model's performance, especially on the minority class that is often the most important.
THE MENTAL MODEL Think of fishing with a net. Precision is the purity of your catch: of everything in your net, what percentage is fish versus junk (old boots, seaweed)? High precision means a net full of fish. Recall is the completeness of your catch: of all the fish in the entire lake, what percentage did you catch? High recall means you didn't leave many fish behind. You can increase recall by using a huge net, but you'll likely catch more junk, lowering your precision. F1-Score is a single number that helps you balance this trade-off.
HOW IT WORKS Performance is measured in terms of True Positives (TP), False Positives (FP), and False Negatives (FN). Precision = TP / (TP + FP). This is the ratio of correct positive predictions to the total number of positive predictions. It answers: "When my model predicts something is a cat, how often is it right?" Recall = TP / (TP + FN). This is the ratio of correct positive predictions to the total number of actual positives in the data. It answers: "Of all the cats that actually exist, how many did my model find?" F1-Score = 2 * (Precision * Recall) / (Precision + Recall). This is the harmonic mean of precision and recall. It gives a single score that is high only when both precision and recall are high.
WHEN TO USE IT Use these metrics for any binary or multi-class classification problem, especially when class imbalance is a concern or the costs of false positives and false negatives are different. This is common in medical diagnosis, fraud detection, spam filtering, and object detection in computer vision.
WHEN NOT TO USE IT These metrics are not used for regression tasks where you predict a continuous value (like a stock price or temperature). While you can use accuracy for classification, Precision and Recall often provide more actionable insights, especially when one type of error is more costly than another.
ONE CANONICAL EXAMPLE A model screens 1,000 images for cats, where 50 images actually contain a cat. The model flags 40 images as having a cat. Of these 40, 35 are correct (TP=35) and 5 are incorrect (FP=5). The model missed 15 images that did have cats (FN=15). Precision = 35 / (35 + 5) = 87.5%. When the model says "cat", it's right 87.5% of the time. Recall = 35 / (35 + 15) = 70%. The model found 70% of all the cats.
Read the original → en.wikipedia.org
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.