-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Division by zero using SGDClassifier with alpha=0 #5329
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
Comments
+1 for either raising an error if alpha=0 or default to none automatically.
I guess the later option can make grid search param grid easier to handle...
|
@agramfort even when penalty='none' if alpha=0 the exception is thrown. So I think alpha is being used somewhere other than the regularisation term. |
However, the docstring in We should probably:
|
so we throw an error ?
|
@agramfort @TomDLT I was looking for an easy enhancement to start contributing to scikit-learn. Is this something I can pick up ? |
@rrohan Excelent, go ahead ! |
[MRG+1] fixes #5329. Division by zero using SGDClassifier
When using SGDClassifier, setting alpha=0 throws division by zero warnings and underflow/overflow exceptions. This happens ignoring what the penalty term is set to.
If penalty is 'none', I think SGDClassifier should accept alpha=0.
The problem is that, when I set the penalty to 'none' and set different numbers for alpha, I get different results (shuffle is False) which I don't expect because I don't have any regularization any more. So I think something other than regularization is using the alpha parameter.
Reproduction:
The problem is reproducible by setting alpha=0 in one of 20newsgroup SGDClassifiers.
Errors:
The text was updated successfully, but these errors were encountered: