Daily Dose of Data Science

Share this post

A Simple and Intuitive Guide to Understanding Precision and Recall

www.blog.dailydoseofds.com

Discover more from Daily Dose of Data Science

High-quality insights on Data Science and Python, along with best practices — shared daily. Get a 550+ Page Data Science PDF Guide and 450+ Practice Questions Notebook, FREE.
Over 36,000 subscribers
Continue reading
Sign in

A Simple and Intuitive Guide to Understanding Precision and Recall

Using the mindset technique.

Avi Chawla
Aug 6, 2023
25
Share this post

A Simple and Intuitive Guide to Understanding Precision and Recall

www.blog.dailydoseofds.com
3
Share

I have seen many folks struggling to intuitively understand Precision and Recall.

These fairly straightforward metrics often intimidate many.

Yet, adopting the Mindset Technique can be incredibly helpful.

Let me walk you through it today.

For simplicity, we’ll call the "Positive class" as our class of interest.

Precision

Formally, Precision answers the following question:

“What proportion of positive predictions were actually positive?”

Let’s understand that from a mindset perspective.

When you are in a Precision Mindset, you don’t care about getting every positive sample correctly classified.

But it’s important that every positive prediction you get should actually be positive.

The illustration below is an example of high Precision. All positive predictions are indeed positive, even though some positives have been left out.

Precision Mindset: All Positive predictions are actually positive, even though some have been left out

For instance, consider a book recommendation system. Say a positive prediction means you’d like the recommended book.

In a Precision Mindset, you are okay if the model does not recommend all good books in the world.

Precision Mindset: It’s okay to miss out on some good books but recommend only good books

But what it recommends should be good.

So even if this system recommended only one book and you liked it, this gives a Precision of 100%.

This is because what it classified as “Positive” was indeed “Positive.”

To summarize, in a high Precision Mindset, all positive predictions should actually be positive.

Recall

Recall is a bit different. It answers the following question:

“What proportion of actual positives was identified correctly by the model?”

When you are in a Recall Mindset, you care about getting each and every positive sample correctly classified.

It’s okay if some positive predictions were not actually positive.

But all positive samples should get classified as positive.

The illustration below is an example of high recall. All positive samples were classified correctly as positive, even though some were actually negative.

Recall Mindset: All positive samples are correctly classified

For instance, consider an interview shortlisting system based on their resume. A positive prediction means that the candidate should be invited for an interview.

In a Recall Mindset, you are okay if the model selects some incompetent candidates.

Recall Mindset: Just focus on correctly classifying all positive samples

But it should not miss out on inviting any skilled candidate.

So even if this system says that all candidates (good or bad) are fit for an interview, it gives you a Recall of 100%.

This is because it didn’t miss out on any of the positive samples.


Which metric to choose entirely depends on what’s important to the problem at hand:

Optimize Precision if:

  1. You care about getting ONLY quality (or positive) predictions.

  2. You are okay if some quality (or positive) samples are left out.

Optimize Recall if:

  1. You care about getting ALL quality (or positive) samples correct.

  2. You are okay if some non-quality (or negative) samples also come along.

I hope that was helpful :)

👉 Over to you: What analogy did you first use to understand Precision and Recall?

Thanks for reading Daily Dose of Data Science! Subscribe for free to learn something new and insightful about Python and Data Science every day. Also, get a Free Data Science PDF (350+ pages) with 250+ tips.

👉 If you liked this post, don’t forget to leave a like ❤️. It helps more people discover this newsletter on Substack and tells me that you appreciate reading these daily insights. The button is located towards the bottom of this email.

Thanks for reading!


Whenever you’re ready, here are a couple of more ways I can help you:

  • Get the full experience of the Daily Dose of Data Science. Every week, receive two curiosity-driven deep dives that:

    • Make you fundamentally strong at data science and statistics.

    • Help you approach data science problems with intuition.

    • Teach you concepts that are highly overlooked or misinterpreted.

Daily Dose of Data Science Blogs
  • Promote your product to over 28,000 subscribers by sponsoring this newsletter.


👉 Tell the world what makes this newsletter special for you by leaving a review here :)

Review Daily Dose of Data Science

👉 If you love reading this newsletter, feel free to share it with friends!

Share Daily Dose of Data Science

25
Share this post

A Simple and Intuitive Guide to Understanding Precision and Recall

www.blog.dailydoseofds.com
3
Share
Previous
Next
3 Comments
Share this discussion

A Simple and Intuitive Guide to Understanding Precision and Recall

www.blog.dailydoseofds.com
Pummy
Aug 7Liked by Avi Chawla

Simple and precise, thank you

Expand full comment
Reply
Share
Francois Ascani
Aug 6Liked by Avi Chawla

Excellent. We don't do enough of getting the intuition right in machine learning so this is a great complement.

Expand full comment
Reply
Share
1 more comment...
Top
New
Community

No posts

Ready for more?

© 2023 Avi Chawla
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing