I'd expect that for a precision-recall curve, precision decreases while recall increases monotonically. I have a plot that is not smooth and looks funny. I used scikit learn the values for plotting the curve. Is the curve below abnormal? If yes, why and how can I correct it considering scikit learn automatically sorts the true and predicted labels. If the plot is OK, how best do I explain this behaviour? enter image description here


This is definitely possible. When you are reducing the threshold, you will never decrease the recall (you can only flag more of the positive examples as positive). Precision is looking at all the examples that you flag positively, and of those the fraction that are truly positive. This means when you are reducing the threshold, you might not add any true positives but only false positives, thereby lowering your precision. Let's take a look at a fabricated example, where P is positive and N is negative. The samples are ranked by score/probability. Everything before the threshold is flagged as positive:


If we put the threshold between items 2 and 3, we get a precision of $1$ and a recall of $0.5$:


When we put it between items 3 and 4, we keep the same recall but our precision drops to $0.6667$:

  • $\begingroup$ Thank you! Does this also apply to PR curves that start from (0,0) ? $\endgroup$
    – Anderlecht
    Nov 21 '17 at 22:56
  • $\begingroup$ Very good explanation! $\endgroup$
    – Vaibhav
    Apr 21 '20 at 6:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.