Skip to content

Enhance ROC Curve Display Tests for Improved Clarity and Maintainability #31253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions sklearn/metrics/_plot/tests/test_roc_curve_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from sklearn import clone
from sklearn.compose import make_column_transformer
from sklearn.datasets import load_breast_cancer, load_iris
from sklearn.datasets import load_breast_cancer, load_iris, make_classification
from sklearn.exceptions import NotFittedError
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import RocCurveDisplay, auc, roc_curve
Expand All @@ -26,8 +26,16 @@ def data():

@pytest.fixture(scope="module")
def data_binary(data):
X, y = data
return X[y < 2], y[y < 2]
X, y = make_classification(
n_samples=200,
n_features=20,
n_informative=5,
n_redundant=2,
flip_y=0.1, # Add some label noise
class_sep=0.8, # Reduce separation for more overlap
random_state=42,
)
return X, y


@pytest.mark.parametrize("response_method", ["predict_proba", "decision_function"])
Expand Down
Loading