8000 MAINT Clean-up remaining SGDClassifier(loss="log") (#25938) · thomasjpfan/scikit-learn@e75d8a6 · GitHub
[go: up one dir, main page]

Skip to content

Commit e75d8a6

Browse files
authored
MAINT Clean-up remaining SGDClassifier(loss="log") (scikit-learn#25938)
1 parent 58f80da commit e75d8a6

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

benchmarks/bench_rcv1_logreg_convergence.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def get_max_squared_sum(X):
240240
SGDClassifier(
241241
alpha=1.0 / C / n_samples,
242242
penalty="l2",
243-
loss="log",
243+
loss="log_loss",
244244
fit_intercept=fit_intercept,
245245
verbose=0,
246246
),

sklearn/linear_model/_logistic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ class LogisticRegression(LinearClassifierMixin, SparseCoefMixin, BaseEstimator):
10131013
See Also
10141014
--------
10151015
SGDClassifier : Incrementally trained logistic regression (when given
1016-
the parameter ``loss="log"``).
1016+
the parameter ``loss="log_loss"``).
10171017
LogisticRegressionCV : Logistic regression with built-in cross validation.
10181018
10191019
Notes

sklearn/tests/test_multioutput.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ def test_hasattr_multi_output_predict_proba():
202202

203203
# check predict_proba passes
204204
def test_multi_output_predict_proba():
205-
sgd_linear_clf = SGDClassifier(random_state=1, max_iter=5, loss="log_loss")
206-
param = {"loss": ("hinge", "log", "modified_huber")}
205+
sgd_linear_clf = SGDClassifier(random_state=1, max_iter=5)
206+
param = {"loss": ("hinge", "log_loss", "modified_huber")}
207207

208208
# inner function for custom scoring
209209
def custom_scorer(estimator, X, y):
@@ -213,7 +213,11 @@ def custom_scorer(estimator, X, y):
213213
return 0.0
214214

215215
grid_clf = GridSearchCV(
216-
sgd_linear_clf, param_grid=param, scoring=custom_scorer, cv=3
216+
sgd_linear_clf,
217+
param_grid=param,
218+
scoring=custom_scorer,
219+
cv=3,
220+
error_score="raise",
217221
)
218222
multi_target_linear = MultiOutputClassifier(grid_clf)
219223
multi_target_linear.fit(X, y)

0 commit comments

Comments
 (0)
0