Back to Study Material Machine Learning

Precision and recall

Precision and recall are complementary metrics that together describe how a classifier handles positive predictions. Each captures a different dimension of...

Precision and recall

Two Perspectives on Classifier Quality

Precision and recall are complementary metrics that together describe how a classifier handles positive predictions. Each captures a different dimension of performance, and their relative importance depends entirely on the costs of the two types of errors in a given application.

Precision answers the question: of all the examples the model predicted as positive, what fraction were actually positive? High precision means that when the model says yes, it is usually right. Low precision means the model generates many false alarms. The formula is true positives divided by true positives plus false positives.

Recall answers the question: of all the actually positive examples, what fraction did the model correctly find? High recall means the model catches most positive cases. Low recall means it misses many of them. The formula is true positives divided by true positives plus false negatives.

There is a fundamental tension between precision and recall. Lowering the decision threshold (predicting positive more often) increases recall — the model catches more true positives — but decreases precision because it also generates more false positives. Raising the threshold has the opposite effect. The precision-recall curve plots this tradeoff across all possible thresholds.

The F1 score is the harmonic mean of precision and recall and provides a single number that balances both. It is more appropriate than accuracy when classes are imbalanced. When the costs of false positives and false negatives are not equal, the F-beta score weights recall by a factor beta, allowing the practitioner to explicitly prioritize one over the other.

A concrete example: in cancer screening, high recall is critical — missing a cancer (false negative) is far more dangerous than requiring a patient to undergo further tests unnecessarily (false positive). In spam filtering, high precision may matter more — incorrectly blocking a legitimate email is more disruptive than allowing some spam through.

Exam tip: always connect precision and recall to business consequences. Saying "high recall because missing a case is dangerous" demonstrates applied understanding beyond the formulas.