8000 DOC: use curve_kwargs instead of kwargs in example to avoid warnings by glemaitre · Pull Request #31447 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

DOC: use curve_kwargs instead of kwargs in example to avoid warnings #31447

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

Merged
Merged
Show file tree
Hide file tree
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
9 changes: 3 additions & 6 deletions examples/miscellaneous/plot_outlier_detection_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,7 @@ def fit_predict(estimator, X):
ax=ax,
plot_chance_level=(model_idx == len(n_neighbors_list) - 1),
chance_level_kw={"linestyle": (0, (1, 10))},
linestyle=linestyle,
linewidth=2,
curve_kwargs=dict(linestyle=linestyle, linewidth=2),
)
_ = ax.set_title("RobustScaler with varying n_neighbors\non forestcover dataset")

Expand Down Expand Up @@ -395,8 +394,7 @@ def fit_predict(estimator, X):
ax=ax,
plot_chance_level=(model_idx == len(preprocessor_list) - 1),
chance_level_kw={"linestyle": (0, (1, 10))},
linestyle=linestyle,
linewidth=2,
curve_kwargs=dict(linestyle=linestyle, linewidth=2),
)
_ = ax.set_title("Fixed n_neighbors with varying preprocessing\non forestcover dataset")

Expand Down Expand Up @@ -447,8 +445,7 @@ def fit_predict(estimator, X):
ax=ax,
plot_chance_level=(model_idx == len(preprocessor_list) - 1),
chance_level_kw={"linestyle": (0, (1, 10))},
linestyle=linestyle,
linewidth=2,
curve_kwargs=dict(linestyle=linestyle, linewidth=2),
)
ax.set_title(
"Fixed n_neighbors with varying preprocessing\non cardiotocography dataset"
Expand Down
6 changes: 4 additions & 2 deletions examples/miscellaneous/plot_roc_curve_visualization_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
rfc = RandomForestClassifier(n_estimators=10, random_state=42)
rfc.fit(X_train, y_train)
ax = plt.gca()
rfc_disp = RocCurveDisplay.from_estimator(rfc, X_test, y_test, ax=ax, alpha=0.8)
svc_disp.plot(ax=ax, alpha=0.8)
rfc_disp = RocCurveDisplay.from_estimator(
rfc, X_test, y_test, ax=ax, curve_kwargs=dict(alpha=0.8)
)
svc_disp.plot(ax=ax, curve_kwargs=dict(alpha=0.8))
plt.show()
3 changes: 1 addition & 2 deletions examples/model_selection/plot_cost_sensitive_learning.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,7 @@ def plot_roc_pr_curves(vanilla_model, tuned_model, *, title):
X_test,
y_test,
pos_label=pos_label,
linestyle=linestyle,
color=color,
curve_kwargs=dict(linestyle=linestyle, color=color),
ax=axs[1],
name=name,
plot_chance_level=idx == 1,
Expand Down
7 changes: 6 additions & 1 deletion examples/model_selection/plot_det.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,12 @@
)
clf.fit(X_train, y_train)
RocCurveDisplay.from_estimator(
clf, X_test, y_test, ax=ax_roc, name=name, color=color, linestyle=linestyle
clf,
X_test,
y_test,
ax=ax_roc,
name=name,
curve_kwargs=dict(color=color, linestyle=linestyle),
)
DetCurveDisplay.from_estimator(
clf, X_test, y_test, ax=ax_det, name=name, color=color, linestyle=linestyle
Expand Down
6 changes: 3 additions & 3 deletions examples/model_selection/plot_roc.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
y_onehot_test[:, class_id],
y_score[:, class_id],
name=f"{class_of_interest} vs the rest",
color="darkorange",
curve_kwargs=dict(color="darkorange"),
plot_chance_level=True,
despine=True,
)
Expand Down Expand Up @@ -165,7 +165,7 @@
y_onehot_test.ravel(),
y_score.ravel(),
name="micro-average OvR",
color="darkorange",
curve_kwargs=dict(color="darkorange"),
plot_chance_level=True,
despine=True,
)
Expand Down Expand Up @@ -290,7 +290,7 @@
y_onehot_test[:, class_id],
y_score[:, class_id],
name=f"ROC curve for {target_names[class_id]}",
color=color,
curve_kwargs=dict(color=color),
ax=ax,
plot_chance_level=(class_id == 2),
despine=True,
Expand Down
3 changes: 1 addition & 2 deletions examples/model_selection/plot_roc_crossval.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@
X[test],
y[test],
name=f"ROC fold {fold}",
alpha=0.3,
lw=1,
curve_kwargs=dict(alpha=0.3, lw=1),
ax=ax,
plot_chance_level=(fold == n_splits - 1),
)
Expand Down
0