Skip to content

Conversation

@alirezazolanvari
Copy link
Collaborator

@alirezazolanvari alirezazolanvari commented Nov 17, 2025

Introduced:

  • The PCurve class to add Precision Curve.
  • The RCurve class to add Recall Curve.

@codecov
Copy link

codecov bot commented Nov 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.46%. Comparing base (15e6988) to head (2e60f64).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #620      +/-   ##
==========================================
+ Coverage   99.46%   99.46%   +0.01%     
==========================================
  Files          15       15              
  Lines        3298     3312      +14     
  Branches      446      446              
==========================================
+ Hits         3280     3294      +14     
  Misses         12       12              
  Partials        6        6              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alirezazolanvari alirezazolanvari self-assigned this Nov 17, 2025
@alirezazolanvari alirezazolanvari added this to the PYCM v4.6 milestone Nov 17, 2025
@alirezazolanvari alirezazolanvari changed the title Pcurve Pcurve + Rcurve Nov 17, 2025
@alirezazolanvari alirezazolanvari marked this pull request as ready for review November 17, 2025 12:14
Copy link
Collaborator

@sadrasabouri sadrasabouri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor changes and a question raised:

pycm/curve.py Outdated
Comment on lines 300 to 302
for c in self.classes:
self.data[c][self.plot_x_axis].insert(0, 0)
self.data[c][self.plot_y_axis].insert(0, 0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we actually need this? why?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in b767eb5 and 04163c5

README.md Outdated
```
### Precision curve

`PCurve`, added in `version 4.6`, is devised to compute the Precision curve in which the Y axis represents the Precision, and the X axis represents the discrimination thresholds applied to a classifier. Thus, the ideal point is located at the top left of the curve, and a larger area under the curve represents better performance. Precision curve is a graphical representation of binary classifiers' performance. In PyCM, `PCurve` binarizes the output based on the "One vs. Rest" strategy to provide an extension of this curve for multi-class classifiers. Getting the actual labels vector, the target probability estimates of the positive classes, and the list of ordered labels of classes, this method is able to compute and plot Precision per different discrimination thresholds and compute the area under the curve.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't talk about the ideal point for this curve ig; I don't think top-left is the ideal point, nor the area under the curve represents anything meaningful (robustness to threshold or something like this at most if it backs up with literature)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess ideally, top right would be the best precision, but not necessarily the ideal point.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 2e60f64

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, I think we need to add 0 and 1 to the thresholds list to include the full spectrum for plotting the curves.

README.md Outdated
```
### Recall curve

`RCurve`, added in `version 4.6`, is devised to compute the Recall curve in which the Y axis represents the Recall, and the X axis represents the discrimination thresholds applied to a classifier. Thus, the ideal point is located at the top right of the curve, and a larger area under the curve represents better performance. Recall curve is a graphical representation of binary classifiers' performance. In PyCM, `RCurve` binarizes the output based on the "One vs. Rest" strategy to provide an extension of this curve for multi-class classifiers. Getting the actual labels vector, the target probability estimates of the positive classes, and the list of ordered labels of classes, this method is able to compute and plot Recall per different discrimination thresholds and compute the area under the curve.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for here; except I think the highest recall happens in the top-left, but that's not the ideal point.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 2e60f64

@sadrasabouri sadrasabouri merged commit c6a649d into dev Nov 18, 2025
27 checks passed
@sadrasabouri sadrasabouri deleted the pcurve branch November 18, 2025 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants