Skip to content
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

[MRG] API Changes default strategy to prior in DummyClasssifer #15382

Merged

Conversation

thomasjpfan
Copy link
Member

@thomasjpfan thomasjpfan commented Oct 28, 2019

Reference Issues/PRs

Fixes #14625
(supersedes) Closes #14637

What does this implement/fix? Explain your changes.

Changes default of DummyClasssifer to prior (with deprecation)

Any other comments?

Moved this ahead because this needs a deprecation cycle to complete.

CC @glemaitre @NicolasHug @jnothman

TomDLT
TomDLT approved these changes Oct 29, 2019
sklearn/dummy.py Outdated Show resolved Hide resolved
Copy link
Member

@NicolasHug NicolasHug left a comment

Looks good but still a few comment

@@ -63,7 +63,7 @@ def test_classification():
"bootstrap_features": [True, False]})

for base_estimator in [None,
DummyClassifier(),
DummyClassifier(strategy='stratified'),
Copy link
Member

@NicolasHug NicolasHug Oct 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should rather explicitly ignore the warnings in the test and tag for 0.24.

Setting the strategy looks like an intentional thing that has to do with the test, when in reality it's just about avoiding warnings

(GradientBoostingClassifier, _make_multiclass, DummyClassifier),
(GradientBoostingRegressor, make_regression, DummyRegressor)],
[(GradientBoostingClassifier, make_classification,
DummyClassifier(strategy="stratified")),
Copy link
Member

@NicolasHug NicolasHug Oct 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Copy link
Member

@NicolasHug NicolasHug Oct 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(and other places)

@@ -1313,11 +1315,11 @@ def test_gradient_boosting_with_init(gb, dataset_maker, init_estimator):
sample_weight = np.random.RandomState(42).rand(100)

# init supports sample weights
init_est = init_estimator()
init_est = clone(init_estimator)
Copy link
Member

@NicolasHug NicolasHug Oct 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this needed?

sklearn/dummy.py Outdated
@@ -45,6 +45,10 @@ class DummyClassifier(MultiOutputMixin, ClassifierMixin, BaseEstimator):
the user. This is useful for metrics that evaluate a non-majority
class
.. versionchanged:: 0.22
The default value of `strategy` will change from "stratified" in
version 0.22 to "prior" in version 0.24.
Copy link
Member

@NicolasHug NicolasHug Oct 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand what you want to say.

We could either just say that it will be changed in 0.24, or also mention that a warning is raised starting from 0.22

Copy link
Member Author

@thomasjpfan thomasjpfan Oct 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jnothman
Copy link
Member

@jnothman jnothman commented Nov 5, 2019

Good to merge, @NicolasHug?

Copy link
Member

@NicolasHug NicolasHug left a comment

thanks @thomasjpfan

@jnothman jnothman merged commit ee5b34d into scikit-learn:master Nov 5, 2019
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants