Inverse Relationship Between Precision and Recall The 2019 Stack Overflow Developer Survey Results Are InRelationship between KS, AUROC, and GiniTerm for relative recallIs this a good classified model based confusion matrix and classification report?How do I pick “K” for precision at K and recall at K?How to calculate Precision and Recall using confusion matrix in Matlab?Can tuning individual precision and recall classification thresholds improve deep learning models?Matrix Confusion - Get Model PrecisionPrecision and Recall if not binaryWhy validation loss worsens while precision/recall continue to improve?Hands on Machine Learning with Scikit Learn and TensorFlow Confusion Matrix with VERY BAD score

Accepted by European university, rejected by all American ones I applied to? Possible reasons?

Why isn't the circumferential light around the M87 black hole's event horizon symmetric?

Loose spokes after only a few rides

"as much details as you can remember"

If I score a critical hit on an 18 or higher, what are my chances of getting a critical hit if I roll 3d20?

A word that means fill it to the required quantity

Straighten subgroup lattice

Deal with toxic manager when you can't quit

What is the most efficient way to store a numeric range?

Is it possible for absolutely everyone to attain enlightenment?

Does adding complexity mean a more secure cipher?

How come people say “Would of”?

Flight paths in orbit around Ceres?

Is it correct to say the Neural Networks are an alternative way of performing Maximum Likelihood Estimation? if not, why?

Is an up-to-date browser secure on an out-of-date OS?

What information about me do stores get via my credit card?

Why couldn't they take pictures of a closer black hole?

Is it ok to offer lower paid work as a trial period before negotiating for a full-time job?

Did the UK government pay "millions and millions of dollars" to try to snag Julian Assange?

How to type this arrow in math mode?

Did any laptop computers have a built-in 5 1/4 inch floppy drive?

How to type a long/em dash `—`

How can I define good in a religion that claims no moral authority?

Can a flute soloist sit?



Inverse Relationship Between Precision and Recall



The 2019 Stack Overflow Developer Survey Results Are InRelationship between KS, AUROC, and GiniTerm for relative recallIs this a good classified model based confusion matrix and classification report?How do I pick “K” for precision at K and recall at K?How to calculate Precision and Recall using confusion matrix in Matlab?Can tuning individual precision and recall classification thresholds improve deep learning models?Matrix Confusion - Get Model PrecisionPrecision and Recall if not binaryWhy validation loss worsens while precision/recall continue to improve?Hands on Machine Learning with Scikit Learn and TensorFlow Confusion Matrix with VERY BAD score










6












$begingroup$


I made some search to learn precision and recall and I saw some graphs represents inverse relationship between precision and recall and I started to think about it to clarify subject. I wonder the inverse relationship always hold? Suppose I have a binary classification problem and there are positive and negative labeled classes. After training some of the actual positive examples are predicted as true positives and some of them false negatives and some of the actual negative examples are predicted as true negatives and some of them false positives. To calculate precision and recall I use these formulas:
$$Precision = fracTPTP + FP$$ and $$Recall = fracTPTP + FN$$ If I decrease false negatives then true positives increases and in that case don't precision and recall both increase?










share|improve this question









New contributor




Tolga Karahan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$
















    6












    $begingroup$


    I made some search to learn precision and recall and I saw some graphs represents inverse relationship between precision and recall and I started to think about it to clarify subject. I wonder the inverse relationship always hold? Suppose I have a binary classification problem and there are positive and negative labeled classes. After training some of the actual positive examples are predicted as true positives and some of them false negatives and some of the actual negative examples are predicted as true negatives and some of them false positives. To calculate precision and recall I use these formulas:
    $$Precision = fracTPTP + FP$$ and $$Recall = fracTPTP + FN$$ If I decrease false negatives then true positives increases and in that case don't precision and recall both increase?










    share|improve this question









    New contributor




    Tolga Karahan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.







    $endgroup$














      6












      6








      6





      $begingroup$


      I made some search to learn precision and recall and I saw some graphs represents inverse relationship between precision and recall and I started to think about it to clarify subject. I wonder the inverse relationship always hold? Suppose I have a binary classification problem and there are positive and negative labeled classes. After training some of the actual positive examples are predicted as true positives and some of them false negatives and some of the actual negative examples are predicted as true negatives and some of them false positives. To calculate precision and recall I use these formulas:
      $$Precision = fracTPTP + FP$$ and $$Recall = fracTPTP + FN$$ If I decrease false negatives then true positives increases and in that case don't precision and recall both increase?










      share|improve this question









      New contributor




      Tolga Karahan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.







      $endgroup$




      I made some search to learn precision and recall and I saw some graphs represents inverse relationship between precision and recall and I started to think about it to clarify subject. I wonder the inverse relationship always hold? Suppose I have a binary classification problem and there are positive and negative labeled classes. After training some of the actual positive examples are predicted as true positives and some of them false negatives and some of the actual negative examples are predicted as true negatives and some of them false positives. To calculate precision and recall I use these formulas:
      $$Precision = fracTPTP + FP$$ and $$Recall = fracTPTP + FN$$ If I decrease false negatives then true positives increases and in that case don't precision and recall both increase?







      accuracy confusion-matrix






      share|improve this question









      New contributor




      Tolga Karahan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Tolga Karahan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 8 hours ago









      Esmailian

      3,031320




      3,031320






      New contributor




      Tolga Karahan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 10 hours ago









      Tolga KarahanTolga Karahan

      315




      315




      New contributor




      Tolga Karahan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Tolga Karahan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Tolga Karahan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          3 Answers
          3






          active

          oldest

          votes


















          3












          $begingroup$

          Thanks for clear statement of the problem. The point is that if you want to decrease false negatives, you should sufficiently lower the threshold of your decision function. If the false negatives are decreased, as you mentioned, true positives increase but false positives can also increase. As a result, recall will increase and precision will decrease.






          share|improve this answer











          $endgroup$








          • 1




            $begingroup$
            I've just learned this topic and It seems I focused equations to much with neglecting effects of changing model. This explanation helped to clarify things. Thank you.
            $endgroup$
            – Tolga Karahan
            8 hours ago











          • $begingroup$
            @TolgaKarahanYou're welcome. I am very pleased my answer helped.
            $endgroup$
            – pythinker
            8 hours ago










          • $begingroup$
            This is incorrect. See my answer.
            $endgroup$
            – kbrose
            7 hours ago


















          2












          $begingroup$

          You are correct @Tolga, both can increase at the same time. Consider the following data:



          Prediction | True Class
          1.0 | 0
          0.5 | 1
          0.0 | 0


          If you set your cut off point as 0.75, then you have



          $$ Precision = fracTPTP + FP = frac00 + 1 = 0 $$
          $$ Recall = fracTPTP + FN = frac00 + 1 = 0$$



          then if you decrease your cut off point to 0.25, you have



          $$ Precision = fracTPTP + FP = frac11 + 1 = 0.5 $$
          $$ Recall = fracTPTP + FN = frac11 + 0 = 1$$



          and so you can see, both precision and recall increased when we decreased the number of False Negatives.






          share|improve this answer









          $endgroup$












          • $begingroup$
            Thank you. It seems distribution of data is so important and it isn't surprising of course.
            $endgroup$
            – Tolga Karahan
            7 hours ago










          • $begingroup$
            But you still need to be realistic. It is unlikely you can decrease the number of False Negatives without increasing the number of False Positives.
            $endgroup$
            – Pedro Henrique Monforte
            2 hours ago


















          1












          $begingroup$

          If we decrease the false negative, recall always increases, but precision may increase or decrease which I will illustrate.



          Recall



          If we denote $FN$ as $x$, then
          $$TP = P - x$$
          therefore, recall would be
          $$r = fracP-xP-x+x = 1- fracxP$$
          which always increases by decrease in $x$.



          Precision



          For precision, the relation is not as straightforward. Lets start with two examples.



          First case: decrease in precision, by decrease in false negative:



          label model prediction
          1 0.8
          0 0.2
          0 0.2
          1 0.2


          For threshold $0.5$ (false negative = $(1, 0.2)$),



          $$p = frac11+0=1$$



          For threshold $0.0$ (false negative = $$),



          $$p = frac22+2=0.5$$



          Second case: increase in precision, by decrease in false negative (the same as @kbrose example):



          label model prediction
          0 1.0
          1 0.4
          0 0.1


          For threshold $0.5$ (false negative = $(1, 0.4)$),



          $$p = frac00+1=0$$



          For threshold $0.0$ (false negative = $$),



          $$p = frac11+2=0.33$$



          Analysis of precision



          We first assume that




          If we decrease $x:=FN$ by lowering the threshold (labeling more instances as positive),
          $FP$ will increase toward $N$ as well, meaning more negatives will be labeled positive,




          which is a realistic assumption, and then proceed to approximate the $FN$-$FP$ relation with rate $a > 0$ as
          $$FP = N - ax,$$
          which works for a short interval like $[x_0, x_0+Delta x)$, meaning rate $a$ can change by $x$. Then, precision would be
          $$p = fracP-xP-x+N-ax = fracP-xP+N-(1+a)x$$
          and its derivative w.r.t. $x$ would be
          $$fracdpdx = fracaP-N(P+N-(1+a)x)^2$$
          which is negative when $aP-N < 0$. From here, we are working with a smooth, continuous $x$.




          Therefore, by decreasing $x$, recall always increases, but
          precision increases only if $a < N/P$.




          Relation to ROC curve



          This section gives a good intuition about the relation. ROC curve in terms of previous variables can be written as:
          $$beginalign*
          &tpr=fracP-xP, fpr=fracN-axN\
          &Rightarrow x=fracN(1-fpr)a\
          &Rightarrow tpr =1-fracN(1-fpr)aP (*)\
          endalign*$$

          Thus, the slope of ROC curve $(*)$ would be:
          $$slope=fracNaP$$
          Here, we are working with a smooth, continuous ROC curve.



          As a result,



          1. In the left part of ROC curve we have $slope > 1$, thus precision increases, and


          2. In the right part we have $slope < 1$, thus precision decreases.




          This is intuitive,




          By going right (decrease in false negative), recall and precision are increasing, but at a certain point (red bar) precision starts to decrease, although recall continues increasing.




          Note that in a ragged, non-smooth ROC curve, by going right, precision may increase and decrease periodically.






          share|improve this answer











          $endgroup$













            Your Answer





            StackExchange.ifUsing("editor", function ()
            return StackExchange.using("mathjaxEditing", function ()
            StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
            StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
            );
            );
            , "mathjax-editing");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "557"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );






            Tolga Karahan is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f49117%2finverse-relationship-between-precision-and-recall%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            3












            $begingroup$

            Thanks for clear statement of the problem. The point is that if you want to decrease false negatives, you should sufficiently lower the threshold of your decision function. If the false negatives are decreased, as you mentioned, true positives increase but false positives can also increase. As a result, recall will increase and precision will decrease.






            share|improve this answer











            $endgroup$








            • 1




              $begingroup$
              I've just learned this topic and It seems I focused equations to much with neglecting effects of changing model. This explanation helped to clarify things. Thank you.
              $endgroup$
              – Tolga Karahan
              8 hours ago











            • $begingroup$
              @TolgaKarahanYou're welcome. I am very pleased my answer helped.
              $endgroup$
              – pythinker
              8 hours ago










            • $begingroup$
              This is incorrect. See my answer.
              $endgroup$
              – kbrose
              7 hours ago















            3












            $begingroup$

            Thanks for clear statement of the problem. The point is that if you want to decrease false negatives, you should sufficiently lower the threshold of your decision function. If the false negatives are decreased, as you mentioned, true positives increase but false positives can also increase. As a result, recall will increase and precision will decrease.






            share|improve this answer











            $endgroup$








            • 1




              $begingroup$
              I've just learned this topic and It seems I focused equations to much with neglecting effects of changing model. This explanation helped to clarify things. Thank you.
              $endgroup$
              – Tolga Karahan
              8 hours ago











            • $begingroup$
              @TolgaKarahanYou're welcome. I am very pleased my answer helped.
              $endgroup$
              – pythinker
              8 hours ago










            • $begingroup$
              This is incorrect. See my answer.
              $endgroup$
              – kbrose
              7 hours ago













            3












            3








            3





            $begingroup$

            Thanks for clear statement of the problem. The point is that if you want to decrease false negatives, you should sufficiently lower the threshold of your decision function. If the false negatives are decreased, as you mentioned, true positives increase but false positives can also increase. As a result, recall will increase and precision will decrease.






            share|improve this answer











            $endgroup$



            Thanks for clear statement of the problem. The point is that if you want to decrease false negatives, you should sufficiently lower the threshold of your decision function. If the false negatives are decreased, as you mentioned, true positives increase but false positives can also increase. As a result, recall will increase and precision will decrease.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited 2 hours ago









            Pedro Henrique Monforte

            402112




            402112










            answered 9 hours ago









            pythinkerpythinker

            7581212




            7581212







            • 1




              $begingroup$
              I've just learned this topic and It seems I focused equations to much with neglecting effects of changing model. This explanation helped to clarify things. Thank you.
              $endgroup$
              – Tolga Karahan
              8 hours ago











            • $begingroup$
              @TolgaKarahanYou're welcome. I am very pleased my answer helped.
              $endgroup$
              – pythinker
              8 hours ago










            • $begingroup$
              This is incorrect. See my answer.
              $endgroup$
              – kbrose
              7 hours ago












            • 1




              $begingroup$
              I've just learned this topic and It seems I focused equations to much with neglecting effects of changing model. This explanation helped to clarify things. Thank you.
              $endgroup$
              – Tolga Karahan
              8 hours ago











            • $begingroup$
              @TolgaKarahanYou're welcome. I am very pleased my answer helped.
              $endgroup$
              – pythinker
              8 hours ago










            • $begingroup$
              This is incorrect. See my answer.
              $endgroup$
              – kbrose
              7 hours ago







            1




            1




            $begingroup$
            I've just learned this topic and It seems I focused equations to much with neglecting effects of changing model. This explanation helped to clarify things. Thank you.
            $endgroup$
            – Tolga Karahan
            8 hours ago





            $begingroup$
            I've just learned this topic and It seems I focused equations to much with neglecting effects of changing model. This explanation helped to clarify things. Thank you.
            $endgroup$
            – Tolga Karahan
            8 hours ago













            $begingroup$
            @TolgaKarahanYou're welcome. I am very pleased my answer helped.
            $endgroup$
            – pythinker
            8 hours ago




            $begingroup$
            @TolgaKarahanYou're welcome. I am very pleased my answer helped.
            $endgroup$
            – pythinker
            8 hours ago












            $begingroup$
            This is incorrect. See my answer.
            $endgroup$
            – kbrose
            7 hours ago




            $begingroup$
            This is incorrect. See my answer.
            $endgroup$
            – kbrose
            7 hours ago











            2












            $begingroup$

            You are correct @Tolga, both can increase at the same time. Consider the following data:



            Prediction | True Class
            1.0 | 0
            0.5 | 1
            0.0 | 0


            If you set your cut off point as 0.75, then you have



            $$ Precision = fracTPTP + FP = frac00 + 1 = 0 $$
            $$ Recall = fracTPTP + FN = frac00 + 1 = 0$$



            then if you decrease your cut off point to 0.25, you have



            $$ Precision = fracTPTP + FP = frac11 + 1 = 0.5 $$
            $$ Recall = fracTPTP + FN = frac11 + 0 = 1$$



            and so you can see, both precision and recall increased when we decreased the number of False Negatives.






            share|improve this answer









            $endgroup$












            • $begingroup$
              Thank you. It seems distribution of data is so important and it isn't surprising of course.
              $endgroup$
              – Tolga Karahan
              7 hours ago










            • $begingroup$
              But you still need to be realistic. It is unlikely you can decrease the number of False Negatives without increasing the number of False Positives.
              $endgroup$
              – Pedro Henrique Monforte
              2 hours ago















            2












            $begingroup$

            You are correct @Tolga, both can increase at the same time. Consider the following data:



            Prediction | True Class
            1.0 | 0
            0.5 | 1
            0.0 | 0


            If you set your cut off point as 0.75, then you have



            $$ Precision = fracTPTP + FP = frac00 + 1 = 0 $$
            $$ Recall = fracTPTP + FN = frac00 + 1 = 0$$



            then if you decrease your cut off point to 0.25, you have



            $$ Precision = fracTPTP + FP = frac11 + 1 = 0.5 $$
            $$ Recall = fracTPTP + FN = frac11 + 0 = 1$$



            and so you can see, both precision and recall increased when we decreased the number of False Negatives.






            share|improve this answer









            $endgroup$












            • $begingroup$
              Thank you. It seems distribution of data is so important and it isn't surprising of course.
              $endgroup$
              – Tolga Karahan
              7 hours ago










            • $begingroup$
              But you still need to be realistic. It is unlikely you can decrease the number of False Negatives without increasing the number of False Positives.
              $endgroup$
              – Pedro Henrique Monforte
              2 hours ago













            2












            2








            2





            $begingroup$

            You are correct @Tolga, both can increase at the same time. Consider the following data:



            Prediction | True Class
            1.0 | 0
            0.5 | 1
            0.0 | 0


            If you set your cut off point as 0.75, then you have



            $$ Precision = fracTPTP + FP = frac00 + 1 = 0 $$
            $$ Recall = fracTPTP + FN = frac00 + 1 = 0$$



            then if you decrease your cut off point to 0.25, you have



            $$ Precision = fracTPTP + FP = frac11 + 1 = 0.5 $$
            $$ Recall = fracTPTP + FN = frac11 + 0 = 1$$



            and so you can see, both precision and recall increased when we decreased the number of False Negatives.






            share|improve this answer









            $endgroup$



            You are correct @Tolga, both can increase at the same time. Consider the following data:



            Prediction | True Class
            1.0 | 0
            0.5 | 1
            0.0 | 0


            If you set your cut off point as 0.75, then you have



            $$ Precision = fracTPTP + FP = frac00 + 1 = 0 $$
            $$ Recall = fracTPTP + FN = frac00 + 1 = 0$$



            then if you decrease your cut off point to 0.25, you have



            $$ Precision = fracTPTP + FP = frac11 + 1 = 0.5 $$
            $$ Recall = fracTPTP + FN = frac11 + 0 = 1$$



            and so you can see, both precision and recall increased when we decreased the number of False Negatives.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 7 hours ago









            kbrosekbrose

            1,043313




            1,043313











            • $begingroup$
              Thank you. It seems distribution of data is so important and it isn't surprising of course.
              $endgroup$
              – Tolga Karahan
              7 hours ago










            • $begingroup$
              But you still need to be realistic. It is unlikely you can decrease the number of False Negatives without increasing the number of False Positives.
              $endgroup$
              – Pedro Henrique Monforte
              2 hours ago
















            • $begingroup$
              Thank you. It seems distribution of data is so important and it isn't surprising of course.
              $endgroup$
              – Tolga Karahan
              7 hours ago










            • $begingroup$
              But you still need to be realistic. It is unlikely you can decrease the number of False Negatives without increasing the number of False Positives.
              $endgroup$
              – Pedro Henrique Monforte
              2 hours ago















            $begingroup$
            Thank you. It seems distribution of data is so important and it isn't surprising of course.
            $endgroup$
            – Tolga Karahan
            7 hours ago




            $begingroup$
            Thank you. It seems distribution of data is so important and it isn't surprising of course.
            $endgroup$
            – Tolga Karahan
            7 hours ago












            $begingroup$
            But you still need to be realistic. It is unlikely you can decrease the number of False Negatives without increasing the number of False Positives.
            $endgroup$
            – Pedro Henrique Monforte
            2 hours ago




            $begingroup$
            But you still need to be realistic. It is unlikely you can decrease the number of False Negatives without increasing the number of False Positives.
            $endgroup$
            – Pedro Henrique Monforte
            2 hours ago











            1












            $begingroup$

            If we decrease the false negative, recall always increases, but precision may increase or decrease which I will illustrate.



            Recall



            If we denote $FN$ as $x$, then
            $$TP = P - x$$
            therefore, recall would be
            $$r = fracP-xP-x+x = 1- fracxP$$
            which always increases by decrease in $x$.



            Precision



            For precision, the relation is not as straightforward. Lets start with two examples.



            First case: decrease in precision, by decrease in false negative:



            label model prediction
            1 0.8
            0 0.2
            0 0.2
            1 0.2


            For threshold $0.5$ (false negative = $(1, 0.2)$),



            $$p = frac11+0=1$$



            For threshold $0.0$ (false negative = $$),



            $$p = frac22+2=0.5$$



            Second case: increase in precision, by decrease in false negative (the same as @kbrose example):



            label model prediction
            0 1.0
            1 0.4
            0 0.1


            For threshold $0.5$ (false negative = $(1, 0.4)$),



            $$p = frac00+1=0$$



            For threshold $0.0$ (false negative = $$),



            $$p = frac11+2=0.33$$



            Analysis of precision



            We first assume that




            If we decrease $x:=FN$ by lowering the threshold (labeling more instances as positive),
            $FP$ will increase toward $N$ as well, meaning more negatives will be labeled positive,




            which is a realistic assumption, and then proceed to approximate the $FN$-$FP$ relation with rate $a > 0$ as
            $$FP = N - ax,$$
            which works for a short interval like $[x_0, x_0+Delta x)$, meaning rate $a$ can change by $x$. Then, precision would be
            $$p = fracP-xP-x+N-ax = fracP-xP+N-(1+a)x$$
            and its derivative w.r.t. $x$ would be
            $$fracdpdx = fracaP-N(P+N-(1+a)x)^2$$
            which is negative when $aP-N < 0$. From here, we are working with a smooth, continuous $x$.




            Therefore, by decreasing $x$, recall always increases, but
            precision increases only if $a < N/P$.




            Relation to ROC curve



            This section gives a good intuition about the relation. ROC curve in terms of previous variables can be written as:
            $$beginalign*
            &tpr=fracP-xP, fpr=fracN-axN\
            &Rightarrow x=fracN(1-fpr)a\
            &Rightarrow tpr =1-fracN(1-fpr)aP (*)\
            endalign*$$

            Thus, the slope of ROC curve $(*)$ would be:
            $$slope=fracNaP$$
            Here, we are working with a smooth, continuous ROC curve.



            As a result,



            1. In the left part of ROC curve we have $slope > 1$, thus precision increases, and


            2. In the right part we have $slope < 1$, thus precision decreases.




            This is intuitive,




            By going right (decrease in false negative), recall and precision are increasing, but at a certain point (red bar) precision starts to decrease, although recall continues increasing.




            Note that in a ragged, non-smooth ROC curve, by going right, precision may increase and decrease periodically.






            share|improve this answer











            $endgroup$

















              1












              $begingroup$

              If we decrease the false negative, recall always increases, but precision may increase or decrease which I will illustrate.



              Recall



              If we denote $FN$ as $x$, then
              $$TP = P - x$$
              therefore, recall would be
              $$r = fracP-xP-x+x = 1- fracxP$$
              which always increases by decrease in $x$.



              Precision



              For precision, the relation is not as straightforward. Lets start with two examples.



              First case: decrease in precision, by decrease in false negative:



              label model prediction
              1 0.8
              0 0.2
              0 0.2
              1 0.2


              For threshold $0.5$ (false negative = $(1, 0.2)$),



              $$p = frac11+0=1$$



              For threshold $0.0$ (false negative = $$),



              $$p = frac22+2=0.5$$



              Second case: increase in precision, by decrease in false negative (the same as @kbrose example):



              label model prediction
              0 1.0
              1 0.4
              0 0.1


              For threshold $0.5$ (false negative = $(1, 0.4)$),



              $$p = frac00+1=0$$



              For threshold $0.0$ (false negative = $$),



              $$p = frac11+2=0.33$$



              Analysis of precision



              We first assume that




              If we decrease $x:=FN$ by lowering the threshold (labeling more instances as positive),
              $FP$ will increase toward $N$ as well, meaning more negatives will be labeled positive,




              which is a realistic assumption, and then proceed to approximate the $FN$-$FP$ relation with rate $a > 0$ as
              $$FP = N - ax,$$
              which works for a short interval like $[x_0, x_0+Delta x)$, meaning rate $a$ can change by $x$. Then, precision would be
              $$p = fracP-xP-x+N-ax = fracP-xP+N-(1+a)x$$
              and its derivative w.r.t. $x$ would be
              $$fracdpdx = fracaP-N(P+N-(1+a)x)^2$$
              which is negative when $aP-N < 0$. From here, we are working with a smooth, continuous $x$.




              Therefore, by decreasing $x$, recall always increases, but
              precision increases only if $a < N/P$.




              Relation to ROC curve



              This section gives a good intuition about the relation. ROC curve in terms of previous variables can be written as:
              $$beginalign*
              &tpr=fracP-xP, fpr=fracN-axN\
              &Rightarrow x=fracN(1-fpr)a\
              &Rightarrow tpr =1-fracN(1-fpr)aP (*)\
              endalign*$$

              Thus, the slope of ROC curve $(*)$ would be:
              $$slope=fracNaP$$
              Here, we are working with a smooth, continuous ROC curve.



              As a result,



              1. In the left part of ROC curve we have $slope > 1$, thus precision increases, and


              2. In the right part we have $slope < 1$, thus precision decreases.




              This is intuitive,




              By going right (decrease in false negative), recall and precision are increasing, but at a certain point (red bar) precision starts to decrease, although recall continues increasing.




              Note that in a ragged, non-smooth ROC curve, by going right, precision may increase and decrease periodically.






              share|improve this answer











              $endgroup$















                1












                1








                1





                $begingroup$

                If we decrease the false negative, recall always increases, but precision may increase or decrease which I will illustrate.



                Recall



                If we denote $FN$ as $x$, then
                $$TP = P - x$$
                therefore, recall would be
                $$r = fracP-xP-x+x = 1- fracxP$$
                which always increases by decrease in $x$.



                Precision



                For precision, the relation is not as straightforward. Lets start with two examples.



                First case: decrease in precision, by decrease in false negative:



                label model prediction
                1 0.8
                0 0.2
                0 0.2
                1 0.2


                For threshold $0.5$ (false negative = $(1, 0.2)$),



                $$p = frac11+0=1$$



                For threshold $0.0$ (false negative = $$),



                $$p = frac22+2=0.5$$



                Second case: increase in precision, by decrease in false negative (the same as @kbrose example):



                label model prediction
                0 1.0
                1 0.4
                0 0.1


                For threshold $0.5$ (false negative = $(1, 0.4)$),



                $$p = frac00+1=0$$



                For threshold $0.0$ (false negative = $$),



                $$p = frac11+2=0.33$$



                Analysis of precision



                We first assume that




                If we decrease $x:=FN$ by lowering the threshold (labeling more instances as positive),
                $FP$ will increase toward $N$ as well, meaning more negatives will be labeled positive,




                which is a realistic assumption, and then proceed to approximate the $FN$-$FP$ relation with rate $a > 0$ as
                $$FP = N - ax,$$
                which works for a short interval like $[x_0, x_0+Delta x)$, meaning rate $a$ can change by $x$. Then, precision would be
                $$p = fracP-xP-x+N-ax = fracP-xP+N-(1+a)x$$
                and its derivative w.r.t. $x$ would be
                $$fracdpdx = fracaP-N(P+N-(1+a)x)^2$$
                which is negative when $aP-N < 0$. From here, we are working with a smooth, continuous $x$.




                Therefore, by decreasing $x$, recall always increases, but
                precision increases only if $a < N/P$.




                Relation to ROC curve



                This section gives a good intuition about the relation. ROC curve in terms of previous variables can be written as:
                $$beginalign*
                &tpr=fracP-xP, fpr=fracN-axN\
                &Rightarrow x=fracN(1-fpr)a\
                &Rightarrow tpr =1-fracN(1-fpr)aP (*)\
                endalign*$$

                Thus, the slope of ROC curve $(*)$ would be:
                $$slope=fracNaP$$
                Here, we are working with a smooth, continuous ROC curve.



                As a result,



                1. In the left part of ROC curve we have $slope > 1$, thus precision increases, and


                2. In the right part we have $slope < 1$, thus precision decreases.




                This is intuitive,




                By going right (decrease in false negative), recall and precision are increasing, but at a certain point (red bar) precision starts to decrease, although recall continues increasing.




                Note that in a ragged, non-smooth ROC curve, by going right, precision may increase and decrease periodically.






                share|improve this answer











                $endgroup$



                If we decrease the false negative, recall always increases, but precision may increase or decrease which I will illustrate.



                Recall



                If we denote $FN$ as $x$, then
                $$TP = P - x$$
                therefore, recall would be
                $$r = fracP-xP-x+x = 1- fracxP$$
                which always increases by decrease in $x$.



                Precision



                For precision, the relation is not as straightforward. Lets start with two examples.



                First case: decrease in precision, by decrease in false negative:



                label model prediction
                1 0.8
                0 0.2
                0 0.2
                1 0.2


                For threshold $0.5$ (false negative = $(1, 0.2)$),



                $$p = frac11+0=1$$



                For threshold $0.0$ (false negative = $$),



                $$p = frac22+2=0.5$$



                Second case: increase in precision, by decrease in false negative (the same as @kbrose example):



                label model prediction
                0 1.0
                1 0.4
                0 0.1


                For threshold $0.5$ (false negative = $(1, 0.4)$),



                $$p = frac00+1=0$$



                For threshold $0.0$ (false negative = $$),



                $$p = frac11+2=0.33$$



                Analysis of precision



                We first assume that




                If we decrease $x:=FN$ by lowering the threshold (labeling more instances as positive),
                $FP$ will increase toward $N$ as well, meaning more negatives will be labeled positive,




                which is a realistic assumption, and then proceed to approximate the $FN$-$FP$ relation with rate $a > 0$ as
                $$FP = N - ax,$$
                which works for a short interval like $[x_0, x_0+Delta x)$, meaning rate $a$ can change by $x$. Then, precision would be
                $$p = fracP-xP-x+N-ax = fracP-xP+N-(1+a)x$$
                and its derivative w.r.t. $x$ would be
                $$fracdpdx = fracaP-N(P+N-(1+a)x)^2$$
                which is negative when $aP-N < 0$. From here, we are working with a smooth, continuous $x$.




                Therefore, by decreasing $x$, recall always increases, but
                precision increases only if $a < N/P$.




                Relation to ROC curve



                This section gives a good intuition about the relation. ROC curve in terms of previous variables can be written as:
                $$beginalign*
                &tpr=fracP-xP, fpr=fracN-axN\
                &Rightarrow x=fracN(1-fpr)a\
                &Rightarrow tpr =1-fracN(1-fpr)aP (*)\
                endalign*$$

                Thus, the slope of ROC curve $(*)$ would be:
                $$slope=fracNaP$$
                Here, we are working with a smooth, continuous ROC curve.



                As a result,



                1. In the left part of ROC curve we have $slope > 1$, thus precision increases, and


                2. In the right part we have $slope < 1$, thus precision decreases.




                This is intuitive,




                By going right (decrease in false negative), recall and precision are increasing, but at a certain point (red bar) precision starts to decrease, although recall continues increasing.




                Note that in a ragged, non-smooth ROC curve, by going right, precision may increase and decrease periodically.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 2 hours ago

























                answered 4 hours ago









                EsmailianEsmailian

                3,031320




                3,031320




















                    Tolga Karahan is a new contributor. Be nice, and check out our Code of Conduct.









                    draft saved

                    draft discarded


















                    Tolga Karahan is a new contributor. Be nice, and check out our Code of Conduct.












                    Tolga Karahan is a new contributor. Be nice, and check out our Code of Conduct.











                    Tolga Karahan is a new contributor. Be nice, and check out our Code of Conduct.














                    Thanks for contributing an answer to Data Science Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    Use MathJax to format equations. MathJax reference.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f49117%2finverse-relationship-between-precision-and-recall%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    How to create a command for the “strange m” symbol in latex? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)How do you make your own symbol when Detexify fails?Writing bold small caps with mathpazo packageplus-minus symbol with parenthesis around the minus signGreek character in Beamer document titleHow to create dashed right arrow over symbol?Currency symbol: Turkish LiraDouble prec as a single symbol?Plus Sign Too Big; How to Call adfbullet?Is there a TeX macro for three-legged pi?How do I get my integral-like symbol to align like the integral?How to selectively substitute a letter with another symbol representing the same letterHow do I generate a less than symbol and vertical bar that are the same height?

                    Category:Tremithousa Media in category "Tremithousa"Navigation menuUpload media34° 49′ 02.7″ N, 32° 26′ 37.32″ EOpenStreetMapGoogle EarthProximityramaReasonatorScholiaStatisticsWikiShootMe

                    Dokschytsy (Steed) Kwelen | NawigatsjuunBelarus: Vitebsk Region, citypopulation.de