Skip to content

Commit

Permalink
MAINT Clean-up remaining SGDClassifier(loss="log") (#25938)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremiedbb authored Mar 22, 2023
1 parent 58f80da commit e75d8a6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
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

0 comments on commit e75d8a6

Please sign in to comment.