What are precision and recall

Precision and recall are two metrics used to evaluate classification models. Both measure how well the model identifies positive cases, but in different ways. Precision focuses on the quality of the positive results returned. Recall focuses on the quantity of actual positives the model managed to find. These metrics are essential for understanding a model’s true behavior in production.

How precision and recall work

Precision calculates the proportion of positive results that were truly positive. In other words, of the cases the model labeled as positive, how many were correct. Recall calculates the proportion of actual positives that the model identified. In other words, of all the positive cases that existed, how many were found. Precision answers the quality question. Recall answers the coverage question.

Practical example

Imagine a system that filters spam emails. When the model marks an email as spam, we want to know whether the marking was correct. That is precision. We also want to know whether the model missed real spam. That is recall. A model that marks few emails as spam has fewer false positives, but may miss important spam. The more permissive the model, the higher the recall, but the more false positives appear.

What precision and recall are for

These metrics help choose the right model for each task. If missing a positive is very costly, we prioritize recall. If the cost of a false alarm is high, we prioritize precision. In fraud detection, recall is important. In recommendation systems, precision is often more relevant. Both are useful and should be tracked to understand the model’s real performance.

Relationship with other metrics

Precision and recall do not work alone. Accuracy, for example, measures the fraction of all predictions that are correct, but can be misleading on imbalanced datasets. The F1‑score, which is the harmonic mean of precision and recall, summarizes the two metrics into a single number. Specifically, the F1‑score is useful when the dataset is imbalanced. By tracking precision and recall separately, the team gains a clearer view of which direction to improve the model.