The Wayback Machine - https://web.archive.org/web/20251219084317/https://www.geeksforgeeks.org/machine-learning/precision-and-recall-in-machine-learning/
Open In App

Precision and Recall in Machine Learning

Last Updated : 02 Aug, 2025
Comments
Improve
Suggest changes
10 Likes
Like
Report

Precision and recall are two evaluation metric used to check the performance of Machine Learning Model. Precision is the ratio of a model’s classification of all positive classifications as positive. Recall tells us how many of the actual positive items the model was able to find. Precision and recall helps in classification problems. In this article we will explain Precision and Recall with formula and example.

1. Precision

Precision is the ratio between the True Positives and all the Positives. It shows how many of the “yes” predictions made by the model were actually correct. It helps us reduce wrong “yes” guesses which are called false positives (FP). Precision is calculated as:

precision
Precision

Imagine you build a model to find birds in photos. It marks some photos as "bird."

  • If those marked photos really have birds that’s good (true positives).
  • But if some don’t have birds the model made a mistake (false positives).
Precision-in-ml
Precision

Uses of Precision

  • Precision helps us understand how accurate a model's “yes” predictions are. It is especially useful when the data has more of one kind of result than the other.
  • For example if most emails are not spam and only a few are then precision helps us see how well the model is finding the spam without making too many mistakes. In such uneven data precision helps measure how correctly the model is picking out the less common group like spam or fraud.

Advantages of High Precision

A model with high precision is very good at avoiding mistakes when it says “yes.” This is important in situations where false alarms are a big problem. For example:

  • In spam email detection it's better if real emails don't get wrongly marked as spam.
  • We care more about getting the important emails right than stopping every single spam message.

So in these cases a model that gives fewer wrong "yes" answers is more useful.

Limitations of Precision

  • If we only care about precision then model may miss some real cases. It becomes too careful and may say “no” even when something is actually “yes.”
  • If the model is too focused on being precise it might let lots of spam emails into your inbox because it's afraid of wrongly marking a real email as spam.

2. Recall

Recall tells us how well a model finds all the correct “yes” cases in the data. It checks how many real positive cases the model was able to correctly identify. The formula to calculate recall is:

Screenshot-2025-05-17-114003
Recall
  • True Positives (TP): The model correctly said “yes.”
  • False Negatives (FN): The model missed a real “yes” and said “no” instead.

Imagine a computer model that looks for birds in pictures.

  • Recall tells us how many real birds the model found correctly.
  • A perfect model would find all birds with no misses that means no false negatives.
Recall-in-ml
Recall

Uses of Recall

You use recall when it’s very important to find all possible positive cases even if some of them turn out to be wrong. For example:

  • In medical tests you want to catch every possible patient who may be sick even if that means a few healthy people are wrongly flagged.
  • In fraud detection it’s better to check a few extra normal transactions than to miss a real fraud.

Advantages of High Recall

A model with high recall is very good at not missing anything important. It finds almost all the actual “yes” cases in the data. This is helpful when:

  • Missing a real case is dangerous or costly.
  • For example in cybersecurity missing an attack is worse than accidentally flagging something safe.

Limitations of Recall

Focusing only on recall means the model is optimized to identify as many actual positives as possible even at the cost of incorrectly labeling negatives as positives. This often leads to a high number of false positives.

Suggested Quiz
4 Questions

What does precision measure in a classification model?

  • A

    How many actual positives were correctly predicted

  • B

    The fraction of correctly predicted positives out of total predicted positives

  • C

    The number of incorrect predictions

  • D

    The overall accuracy of the model

Explanation:

Precision is calculated as True Positives divided by the sum of True Positives and False Positives. It tells how many of the predicted positive cases were actually correct.

When is high recall preferred over high precision?

  • A

    When false negatives are more harmful

  • B

    When false positives are more harmful

  • C

    When the model is overfitting

  • D

    When accuracy is the main concern

Explanation:

Recall is important in cases where missing a positive case is costly, such as medical diagnoses where failing to detect a disease could have serious consequences.

Which of the following is not used in calculating Precision?

  • A

    True Positives (TP)

  • B

    False Positives (FP)

  • C

    False Negatives (FN)

  • D

    None of the above

Explanation:

Precision uses only TP and FP; FN is used in recall.

Which situation is best suited for using recall as the primary evaluation metric?

  • A

    When false positives are more harmful than false negatives

  • B

    When the dataset is perfectly balanced

  • C

    When missing a positive case is costly or dangerous

  • D

    When the model makes very few predictions

Explanation:

Recall is emphasized when it's critical not to miss any actual positive cases, such as in medical or fraud detection

Quiz Completed Successfully
Your Score :   2/4
Accuracy :  0%
Login to View Explanation
1/4 1/4 < Previous Next >

Explore