Skip to content

[MRG] Added FutureWarning in sgd models for tol parameter #12399

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 4 commits into from
Oct 24, 2018

Conversation

NicolasHug
Copy link
Member

@NicolasHug NicolasHug commented Oct 17, 2018

Reference Issues/PRs

Addresses #12239 (comment)

What does this implement/fix? Explain your changes.

Added FutureWarning in sgd models if tol is None while max_iter is set.

Any other comments?

if tol is None while max_iter is set
Copy link
Member

@jnothman jnothman left a comment

Choose a reason for hiding this comment

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

There perhaps should be a note in the docs for max_iter too. Thanks

warnings.warn(
"max_iter and tol parameters have been added in %s in "
"0.19. If max_iter is set but tol is left unset, the "
"default value for tol in 0.19 and 0.20 will be None "
Copy link
Member

Choose a reason for hiding this comment

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

I think the semantics of None here are unclear. Is None equivalent to 0?

Copy link
Member

Choose a reason for hiding this comment

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

"is 0"?

"default value for tol in 0.19 and 0.20 will be None "
"but will change in 0.21 to 1e-3. Specify tol to "
"silence this warning." % type(self).__name__,
ChangedBehaviorWarning)
Copy link
Member

Choose a reason for hiding this comment

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

I think this is technically meant to be a FutureWarning

Copy link
Member

Choose a reason for hiding this comment

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

Right,ow it should be a FutureWarning since we didn't change yet.

@amueller
Copy link
Member

all these warnings should be captured in the tests. You will see that tests will fail once you change it to FutureWarning ;)

@amueller
Copy link
Member

(I wouldn't explicitly set tol)

@NicolasHug
Copy link
Member Author

@jnothman

There perhaps should be a note in the docs for max_iter too.

Not sure what you mean, where in the docs and about what?

@NicolasHug NicolasHug changed the title [MRG] Added ChangedBehaviorWarning in sgd models [MRG] Added FutureWarning in sgd models for tol parameter Oct 19, 2018
@@ -31,6 +31,11 @@
from sklearn.model_selection import RandomizedSearchCV


# 0.23. warning about tol not having its correct default value.
pytestmark = pytest.mark.filterwarnings(
"ignore:max_iter and tol parameters have been")
Copy link
Member Author

Choose a reason for hiding this comment

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

There was so many warnings in this file that I globally ignored them, for the whole module.

@jnothman
Copy link
Member

By a note in the docs I meant that the max_iter description should say that tol should be set at the same time for forwards compatibility

Copy link
Member

@jnothman jnothman left a comment

Choose a reason for hiding this comment

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

You can ignore with a module level fixture, rather than touching each test

@NicolasHug
Copy link
Member Author

You can ignore with a module level fixture, rather than touching each test

I've done this for one of the modules that had tons of failing tests but not for the others, because it doesn't seem to be a common practice (in scikit-learn). But I find it better myself, yeah. Should I use the module-level ignore instead?

@NicolasHug
Copy link
Member Author

max_iter description should say that tol should be set at the same time for forwards compatibility

But this is only true up to 0.21 right?

@amueller
Copy link
Member

Can you add mention of the changing default value to whatsnew in the change model section?

@amueller
Copy link
Member

though actually nevermind, I'll do that for 0.21, not here.

@amueller amueller merged commit 4e2da4a into scikit-learn:master Oct 24, 2018
@NicolasHug NicolasHug deleted the tol_sgd_futurewarning branch October 24, 2018 18:18
thoo pushed a commit to thoo/scikit-learn that referenced this pull request Nov 14, 2018
…rn#12399)

* Added ChangedBehaviorWarning in sgd models

if tol is None while max_iter is set

* Changed to FutureWarning and clarified None meaning

* Ignored warningin tests

* Ignore warnings in tests, round 2
jnothman pushed a commit to jnothman/scikit-learn that referenced this pull request Nov 14, 2018
…rn#12399)

* Added ChangedBehaviorWarning in sgd models

if tol is None while max_iter is set

* Changed to FutureWarning and clarified None meaning

* Ignored warningin tests

* Ignore warnings in tests, round 2
jnothman pushed a commit to jnothman/scikit-learn that referenced this pull request Nov 14, 2018
…rn#12399)

* Added ChangedBehaviorWarning in sgd models

if tol is None while max_iter is set

* Changed to FutureWarning and clarified None meaning

* Ignored warningin tests

* Ignore warnings in tests, round 2
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
…rn#12399)

* Added ChangedBehaviorWarning in sgd models

if tol is None while max_iter is set

* Changed to FutureWarning and clarified None meaning

* Ignored warningin tests

* Ignore warnings in tests, round 2
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
koenvandevelde pushed a commit to koenvandevelde/scikit-learn that referenced this pull request Jul 12, 2019
…rn#12399)

* Added ChangedBehaviorWarning in sgd models

if tol is None while max_iter is set

* Changed to FutureWarning and clarified None meaning

* Ignored warningin tests

* Ignore warnings in tests, round 2
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.

3 participants