Fix RetrievalPrecisionRecallCurve axis labels and swap axis#3404
Fix RetrievalPrecisionRecallCurve axis labels and swap axis#3404carandraug wants to merge 7 commits into
Conversation
…ghtning-AI#3403) While "True positive rate" is the same as "Recall", "False positive rate" is not the same as "Precision". Still, this commit change both axis labels for consistency. It seems this issue was originally introduced as part of Lightning-AI#1623 when the plot method was first added using plot_binary_roc_curve. ROCs do plot TPR against FPR. I'm guessing that when plot_binary_roc_curve was replaced with plot_curve in Lightning-AI#1660, those wrong labels were kept.
…ning-AI#3403) It is standard to use Recall on the x axis and Precision on the y axis but the current implementation has it flipped. This is possibly because the implementation evolved (incorrectly) from ROCs where TPR (aka Recall) is on the y axis and FPR on the x axis.
There was a problem hiding this comment.
Pull request overview
This PR fixes the RetrievalPrecisionRecallCurve.plot() visualization to correctly present a precision–recall curve, aligning both axis labels and axis orientation with standard PR-curve conventions and with TorchMetrics’ classification PR-curve plotting.
Changes:
- Swap plotted axes so Recall is on the x-axis and Precision is on the y-axis.
- Correct axis labels from ROC terminology (FPR/TPR) to PR terminology (Recall/Precision).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3404 +/- ##
========================================
- Coverage 37% 31% -6%
========================================
Files 349 349
Lines 19901 19906 +5
========================================
- Hits 7264 6169 -1095
- Misses 12637 13737 +1100 🚀 New features to boost your workflow:
|
Mirror classification PR-curve pattern: assign curve_computed before swapping axis order and add comment explaining the swap convention. --- Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Guard against regressions in the axis label fix from issue Lightning-AI#3403. --- Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
--- Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
What does this PR do?
Fixes #3403 .
Somehow, the plots for retrieval precision recall curves evolved to label the axis True and False positive rates (TPR and FPR). These are the same labels used in ROCs. There are three isues: the label FPR is wrong (precision and FPR are not the same thing), it is weird to use TPR (TPR and Recall are the same) as label name if the other label name is Precision, it is odd to use Precision on the x axis. This PR addresses the three things (the first two issues in the first commit), the third issue in the second commit).
I think the reason we ended up in this situation is (repeated here from the commit messages in this PR):
and
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.