Skip to content

Commit

Permalink
MNT Remove warning in logistic regression cv scoring (scikit-learn#15184
Browse files Browse the repository at this point in the history
)
  • Loading branch information
thomasjpfan authored and rth committed Oct 18, 2019
1 parent 56edce8 commit e489aab
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
8 changes: 0 additions & 8 deletions sklearn/linear_model/logistic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2248,15 +2248,7 @@ def score(self, X, y, sample_weight=None):
Score of self.predict(X) wrt. y.
"""

if self.scoring is not None:
warnings.warn("The long-standing behavior to use the "
"accuracy score has changed. The scoring "
"parameter is now used. "
"This warning will disappear in version 0.22.",
ChangedBehaviorWarning)
scoring = self.scoring or 'accuracy'

scoring = get_scorer(scoring)

return scoring(self, X, y, sample_weight=sample_weight)
3 changes: 1 addition & 2 deletions sklearn/linear_model/tests/test_logistic.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ def __call__(self, model, X, y, sample_weight=None):

# reset mock_scorer
mock_scorer.calls = 0
with pytest.warns(ChangedBehaviorWarning):
custom_score = lr.score(X, lr.predict(X))
custom_score = lr.score(X, lr.predict(X))

assert custom_score == mock_scorer.scores[0]
assert mock_scorer.calls == 1
Expand Down

0 comments on commit e489aab

Please sign in to comment.