Data Science and Evaluation

Precision vs Recall vs F1 Score

Learn the difference between precision, recall, and F1 score, why they matter more than raw accuracy in many ML tasks, and how to choose the right tradeoff.
Cover image for Precision vs Recall vs F1 Score
EvaluationPrecisionRecallF1 Score

Precision, recall, and F1 score are evaluation metrics used when simple accuracy is not enough. The short version is that precision asks, "When the model predicts positive, how often is it right?" Recall asks, "When the true positive cases exist, how often does the model find them?" F1 score combines the two into one measure.

These metrics matter because different mistakes have different costs.

Why Accuracy Can Mislead

Suppose only 1% of transactions are fraudulent.

A model that predicts "not fraud" for every transaction will be 99% accurate, but it will also be useless.

That is why accuracy can hide failure in imbalanced or high-stakes settings. We need metrics that pay attention to the types of errors the model is making.

Precision: How Trustworthy Are Positive Predictions?

Precision focuses on predicted positives.

If a model flags 100 emails as spam and 80 truly are spam, the precision is 80%.

So precision answers:

"When I say yes, how often should you trust me?"

High precision is important when false positives are expensive.

Examples:

  • incorrectly flagging a legitimate transaction as fraud
  • marking a healthy patient as high-risk
  • banning legitimate users in moderation systems

Recall: How Many Real Positives Did the Model Catch?

Recall focuses on actual positives.

If there are 100 fraudulent transactions and the model catches 80 of them, recall is 80%.

So recall answers:

"Of all the positives that really existed, how many did I find?"

High recall matters when false negatives are expensive.

Examples:

  • missing a cancer case
  • failing to detect fraud
  • overlooking a severe safety event

The Core Tradeoff

Precision and recall often move against each other.

If you make the model very conservative before it predicts positive, precision may go up because it only flags strong cases. But recall may go down because it misses many real positives.

If you make the model more permissive, recall may improve because it catches more positives, but precision may drop because more false positives slip in.

That is why metric choice is a business and domain decision, not just a mathematical one.

What F1 Score Is Trying to Do

F1 score combines precision and recall into a single number using their harmonic mean.

It is high only when both precision and recall are reasonably strong.

The harmonic mean matters because it punishes imbalance. If one metric is high and the other is poor, the F1 score does not let the strong one completely hide the weak one.

So F1 is useful when you want one summary number but still care about both types of performance.

A Concrete Example

Imagine a disease screening system.

Model A:

  • precision = 95%
  • recall = 50%

Model B:

  • precision = 75%
  • recall = 85%

Which one is better?

It depends.

If false alarms are extremely costly, Model A may be acceptable. If missing true cases is the bigger danger, Model B is usually better. F1 score often helps reveal which model is more balanced overall, but the real choice depends on the task.

Precision and Recall Depend on the Decision Threshold

Many models output scores or probabilities, not final yes/no labels.

The threshold determines when the model switches from negative to positive.

Changing the threshold changes:

  • how many predictions count as positive
  • how many false positives you allow
  • how many true positives you recover

So precision and recall are not just model properties. They are also threshold-dependent operating characteristics.

Why These Metrics Matter in Modern ML

Precision and recall are central in:

  • medical diagnosis
  • fraud detection
  • information retrieval
  • recommendation quality filtering
  • moderation systems
  • anomaly detection

In retrieval systems, the same ideas appear naturally:

  • precision asks how many retrieved items are relevant
  • recall asks how much of the relevant set was recovered

So these are not niche textbook metrics. They are part of how real systems get judged.

Common Misunderstandings

Is high precision always better?

No. High precision with terrible recall may mean the model is so cautious that it misses too many important cases.

Is F1 score always the best summary metric?

No. It is useful when precision and recall both matter, but some domains care much more about one than the other.

Does a good cross-entropy loss guarantee a good F1 score?

Not necessarily. Loss and thresholded evaluation metrics measure different aspects of performance.

FAQ

What is the simplest way to remember precision?

Precision asks how often positive predictions are correct.

What is the simplest way to remember recall?

Recall asks how many real positives the model successfully found.

Why do people use F1 score?

Because it gives one number that stays high only when both precision and recall are strong.

When should recall matter more than precision?

When missing true positives is more costly than generating false alarms.

Start here

Need this level of technical clarity inside the actual product work?

The studio handles the implementation side as seriously as the editorial side: architecture, delivery, and the interfaces people are expected to live with.