Enhance ROC Curve Display Tests for Improved Clarity and Maintainability #31254
+12
−13
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.
Commit Description:
Replaced the
data_binary
fixture that filtered classes from a multiclass dataset with a new fixture generating a synthetic binary classification dataset usingmake_classification
. This ensures consistent data characteristics, introduces label noise, and better simulates real-world classification challenges.PR Description:
Summary of Changes:
This PR refactors the
data_binary
fixture in thetest_roc_curve_display.py
file. The previous fixture filtered a multiclass dataset (Iris) to create a binary classification task. However, this approach resulted in AUC values consistently reaching 1.0, which does not reflect real-world challenges.The new fixture utilizes
make_classification
fromsklearn.datasets
to generate a synthetic binary classification dataset with the following characteristics:flip_y=0.1
) to simulate real-world imperfections in the data.class_sep=0.8
) set to avoid perfect separation.These changes provide a more complex and representative dataset for testing the
roc_curve_display
function and other related metrics, thereby improving the robustness of tests.Reference Issues/PRs:
test_roc_curve_display.py
#31243from_cv_results
inRocCurveDisplay
(singleRocCurveDisplay
) #30399 (comment)For Reviewers: