Improve Test Data for Precision-Recall Curve to Show Realistic Shape#124
Merged
idanmoradarthas merged 2 commits intoApr 24, 2026
Conversation
- Added a new fixture `plotly_models_pr_curve_dict` to load precision-recall curve data from a JSON file. - Updated tests for plotting precision-recall curves to use the new fixture, ensuring consistency in data handling. - Modified baseline images for precision-recall curve tests to reflect recent changes in plotting behavior and annotations. These changes enhance the robustness of the precision-recall curve testing framework and ensure accurate visual comparisons.
8 tasks
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
- Updated the `plot_precision_recall_curve_with_thresholds_annotations` function to handle NaN values in thresholds, ensuring that the displayed probability annotations are clear and informative. - Modified the text formatting for annotations to indicate 'N/A' for NaN probabilities, improving the clarity of the visual output. These changes enhance the usability of the precision-recall curve visualization by providing more accurate and user-friendly annotations.
idanmoradarthas
deleted the
100-improve-test-data-for-precision-recall-curve-to-show-realistic-shape
branch
April 24, 2026 03:27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves
Resolves #100
Description
This pull request addresses the need for realistic Precision-Recall curve test visualizations. The previous mock data generated arbitrary, near-perfect (right-angle) PR curves that did not accurately reflect real-world, descending trade-off curve shapes.
To solve this, a new dataset simulating a challenging classification task (with increased label noise and reduced class separation) was generated. The resulting realistic model predictions were saved to a new, dedicated JSON data file for the PR curve tests, ensuring the visual baseline tests correctly represent expected outputs.
Key Changes
plotly_models_pr_curve.jsonwhich contains simulated data with realistic PR threshold trade-offs for Decision Tree, Random Forest, and Gradient Boosting models.plotly_models_pr_curve_dictfixture intest_curves.pyto load the new dataset exclusively for Precision-Recall tests. The existingplotly_models.jsonis preserved to avoid breaking current ROC curve baseline tests.test_plotly_graph_method_shape_mismatchusingpytest.mark.parametrizeto dynamically handle validation against both data files without code duplication.ruffto comply with the project standards.Verification
test_curves.pyunit tests pass successfully.ruff checkandruff format.