-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Deprecations 0.21 sgd tol #12239
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
Deprecations 0.21 sgd tol #12239
Conversation
@@ -1556,12 +1499,11 @@ class SGDRegressor(BaseSGDRegressor): | |||
|
|||
""" | |||
def __init__(self, loss="squared_loss", penalty="l2", alpha=0.0001, | |||
l1_ratio=0.15, fit_intercept=True, max_iter=None, tol=None, | |||
l1_ratio=0.15, fit_intercept=True, max_iter=None, tol=1e-3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing max_iter here.
This comment has been minimized.
This comment has been minimized.
This pull request introduces 1 alert when merging b4fc3c3 into dfd009d - view on LGTM.com new alerts:
Comment posted by LGTM.com |
So it looks like setting |
also if a user used |
@@ -1290,8 +1242,6 @@ def _fit_regressor(self, X, y, alpha, C, loss, learning_rate, | |||
# Windows | |||
seed = random_state.randint(0, np.iinfo(np.int32).max) | |||
|
|||
tol = self._tol if self._tol is not None else -np.inf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this line should stay here, making None an alias for -np.inf
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree.
In any case, we have to be consistent, either keeping this line, or removing the one in fit_binary
:
tol = est.tol if est.tol is not None else -np.inf |
validation_fraction=0.1, verbose=0, warm_start=False) | ||
>>> print(clf.coef_) | ||
[[0.29509834 0.33711843 0.56127352 0.60105546]] | ||
[[-0.6543424 1.54603022 1.35361642 0.22199435]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a really bad sign! I think we might have messed this up somehow.
I thought setting max_iter here meant we automatically set tol
to 0.001 but apparently not?
Ok so if someone set |
told=None was only valid during deprecation, so it's not a problem |
But a user getting a DeprecationWarning for The wise decision would probably be to remove warnings about |
I now see what you mean. I had skimmed. We had told them it was doing something different to what it actually was if they set So I see a choice of:
(Is there a way to systematically avoid this in the future, I wonder?) |
A similar issue arises in #12240 btw. I have no idea how to systematically test for this. The test we want is to assure that people that got no warning will not see changed behavior. But the new behavior is sometimes not even implemented when we raise the warning. |
Well it would require implementing the new behaviour explicitly when
deprecating, and spoofing the default values at completion of deprecation.
|
Yeah. I'm not sure how easy that is in general. We can try? |
Probably hard in general... Maybe there's an elegant way to do it? Just
something to consider.
|
Should we get some sort of warning into 0.20.1? I guess depends on which way we go? |
Sure, a FutureWarning in 0.20.1 wouldn't hurt... |
I'm happy with the progressive option: follow what we had documented, but perhaps issue a ChangedBehaviorWarning if max_iter is set and tol is not. I am okay to issue a FutureWarning in 0.20.1 |
ok. @NicolasHug can you maybe do that? |
closing as we need to wait longer now |
Working on #11992, deprecating the change from n_iter to max_iter/tol in the SGD family