Skip to content

MAINT Clean-up remaining SGDClassifier(loss="log") #25938

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 2 commits into from
Mar 22, 2023
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
2 changes: 1 addition & 1 deletion benchmarks/bench_rcv1_logreg_convergence.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def get_max_squared_sum(X):
SGDClassifier(
alpha=1.0 / C / n_samples,
penalty="l2",
loss="log",
loss="log_loss",
fit_intercept=fit_intercept,
verbose=0,
),
Expand Down
2 changes: 1 addition & 1 deletion sklearn/linear_model/_logistic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ class LogisticRegression(LinearClassifierMixin, SparseCoefMixin, BaseEstimator):
See Also
--------
SGDClassifier : Incrementally trained logistic regression (when given
the parameter ``loss="log"``).
the parameter ``loss="log_loss"``).
LogisticRegressionCV : Logistic regression with built-in cross validation.

Notes
Expand Down
10 changes: 7 additions & 3 deletions sklearn/tests/test_multioutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ def test_hasattr_multi_output_predict_proba():

# check predict_proba passes
def test_multi_output_predict_proba():
sgd_linear_clf = SGDClassifier(random_state=1, max_iter=5, loss="log_loss")
param = {"loss": ("hinge", "log", "modified_huber")}
sgd_linear_clf = SGDClassifier(random_state=1, max_iter=5)
param = {"loss": ("hinge", "log_loss", "modified_huber")}

# inner function for custom scoring
def custom_scorer(estimator, X, y):
Expand All @@ -213,7 +213,11 @@ def custom_scorer(estimator, X, y):
return 0.0

grid_clf = GridSearchCV(
sgd_linear_clf, param_grid=param, scoring=custom_scorer, cv=3
sgd_linear_clf,
param_grid=param,
scoring=custom_scorer,
cv=3,
error_score="raise",
)
multi_target_linear = MultiOutputClassifier(grid_clf)
multi_target_linear.fit(X, y)
Expand Down