-
-
Notifications
You must be signed in to change notification settings - Fork 25.5k
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
DOC add interval range for parameter of SGDRegressor #28373
DOC add interval range for parameter of SGDRegressor #28373
Conversation
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.
Generally looks good to me. Thanks for putting in the effort to fix this!
One comment about adding the ranges to all parameters. All other changes LGTM.
SGDRegressor
's documentationThere 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.
Could you document epsilon
with:
Values must be in the range `[0.0, 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.
Otherwise LGTM.
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Done in b1253fb. Thanks! |
Since the commits addressing the last review, I included two more commits:
I committed in this way to make it easily reversible if you decide that's the way to go. Thank you for looking into this! |
@@ -1125,7 +1125,7 @@ class SGDClassifier(BaseSGDClassifier): | |||
an int greater than 1, averaging will begin once the total number of | |||
samples seen reaches `average`. So ``average=10`` will begin | |||
averaging after seeing 10 samples. | |||
Integer values must be in the range `[1, n_samples]`. | |||
Integer values must be in the range `[0, n_samples]`. |
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 the parameter constraint is [0, n_samples]
, but I don't understand why. Is using 0
just a different way of saying average=True
, as in "start right away"? If yes that is surprising because normally I'd think of 0
, in the context of bool
as False
. So my question is, should we update the constraint to match the doc string (in the text it also says "if set to a value greater than 1")?
Maybe someone with more knowledge can comment.
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.
Looking at the code around, I would correct the parameter validation here because we have a lot of code with something like if self.average > 0
.
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.
@betatim @glemaitre Would you like me to revert the commit that updates the docstrings relative to the average
parameter (it's isolated in d181bda) and open an issue regarding average
constraints and usage?
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.
Indeed this would be easier to handle in a separate PR.
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.
@betatim @glemaitre I opened an issue for this here. Feel free to edit it as you see fit.
As far as I can tell the new doc strings you added are consistent with what the parameter checking system uses. One comment about In general it is easier to not "add on" to an existing PR. In this case it is kind of related but also broadens the scope of the PR (to mroe estimators). I think getting a PR, the author and the reviewers all to converge so that the merge button can be clicked turns out to be quite hard, so adding "divergence" by adding on to a PR tends to prevent convergence :D Not a big deal here especially as this is your first time contributing, more soemthing to consider for the future. |
Thank you very much! I'll be mindful of that in the future. |
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.
LGTM. Let's tackle the average
issue in another PR.
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Reference Issues/PRs
I couldn't find a related issue.
What does this implement/fix? Explain your changes.
The screenshot below is straight from
SGDRegressor
's documentation.The sentence "Also used to compute the learning rate when set to
learning_rate
is set to 'optimal'" in, suffers from multiple issues:SGDClassifier
's documentation.This pull request fixes all of these.
In addition to the above, multiple constraints to the parameters were included in the documentation of the regressor. A couple of opportunistic improvements were also made (in 8262eba).
Any other comments?