feat: add ROC and PR curve pane types with Python API helpers - #1478
Conversation
There was a problem hiding this comment.
Sorry @Manik-Khajuria-5, your pull request is larger than the review limit of 150000 diff characters
ab1eee5 to
93711b0
Compare
There was a problem hiding this comment.
Sorry @Manik-Khajuria-5, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
There was a problem hiding this comment.
Pull request overview
Adds first-class ROC and Precision–Recall curve pane types to Visdom, including Python helpers that compute curve points + AUC (or accept precomputed points) and render them as Plotly line plots, with frontend pane registration so they display correctly.
Changes:
- Add
Visdom.roc_curve()andVisdom.pr_curve()helpers (raw labels/scores or precomputed arrays) with automatic AUC titles and baseline traces. - Allow plot windows to set a custom pane type (
pane_type) so the frontend can distinguish ROC/PR panes from generic plots. - Register
roc_curve/pr_curveas pane types in the React frontend and add a demo example component.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents the new vis.roc_curve and vis.pr_curve APIs and supported opts. |
| py/visdom/utils/server_utils.py | Lets plot windows specify a custom pane type via pane_type. |
| py/visdom/init.pyi | Adds typing stubs for roc_curve / pr_curve. |
| py/visdom/init.py | Implements ROC/PR curve computation + rendering and sends pane_type to the server. |
| js/settings.js | Registers roc_curve and pr_curve pane types (mapped to PlotPane) and sizes. |
| example/demo.py | Wires the new ROC/PR demos into the main demo runner. |
| example/components/plot_roc_pr.py | Adds example usage for ROC and PR curves (raw + precomputed ROC). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@tonypzy Thanks I have appliead the trap formula Can u please review this PR again |
tonypzy
left a comment
There was a problem hiding this comment.
Thanks for your contribution! Since this PR introduces two new types (roc_curve and pr_curve), I think the code below in js/template/exportTemplate.js will cause a bug:
if ((t === 'plot' || t === 'surface') && c && c.data) {
This means these two new types of panels will be skipped entirely when exporting to HTML.
|
@tonypzy Okay I am workung on it once this PR is merged I will raise a new PR for that or will add a fix within this PR only soon |
|
@tonypzy done PLease review again |
|
@rajnisht7 @vedansh-5 @tonypzy @Jayantparashar10 Please review this PR |
|
@Manik-Khajuria-5 @tonypzy the failed html export can be corrected by replacing this line with hence kindly add this in this PR as well |
rajnisht7
left a comment
There was a problem hiding this comment.
@Manik-Khajuria-5 the code works fine just a few suggestions
- add cypress test atleast in
integrartion/pane.js - remove roc_curve and pr_curve from settings.js as it is not maintained for each and every graph but is defined for all the plots, dimension for these plots can be added to integration/pane.js as well and then correct server_utils.py accordingly
Jayantparashar10
left a comment
There was a problem hiding this comment.
I think changes in js/panes/ImageComparePane.js related to this PR
|
@rajnisht7 @Jayantparashar10 All necessary and relevant suggestion has been applied |
vedansh-5
left a comment
There was a problem hiding this comment.
works fine, tested locally - please address the comments from Rajnish and Jayant.
I run locally and you are correct |
tonypzy
left a comment
There was a problem hiding this comment.
please resolve @rajnisht7 's comments. except that, lgtm
|
@rajnisht7 @Jayantparashar10 @tonypzy Please review this PR again I have made all suggestion properly |
tonypzy
left a comment
There was a problem hiding this comment.
please resolve conflicts
|
@rajnisht7 @Jayantparashar10 @tony please review PR |
Jayantparashar10
left a comment
There was a problem hiding this comment.
Tested it locally its working fine and also one thing that js/panes/ImageComparePane.js is unrelated to this PR


Description
Add vis.roc_curve() and vis.pr_curve() methods that accept either raw labels/scores or precomputed arrays. Both compute AUC automatically and render as Plotly lineplots with a baseline reference line.
Motivation and Context
Closes #1225. Users currently have to manually compute curve points and use vis.line(). Built-in helpers lower friction and improve consistency.
Screenshot
How Has This Been Tested?
Types of changes
Checklist: