-
-
Notifications
You must be signed in to change notification settings - Fork 26k
MAINT Use check_scalar to validate scalar in: GeneralizedLinearRegressor #21946
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
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
fcc822c
added check_scalar
reshamas f66cd3c
Merge branch 'main' of github.com:scikit-learn/scikit-learn into cksc…
reshamas 24391d1
added tests for max_iter
reshamas 917b05b
Merge branch 'main' of github.com:scikit-learn/scikit-learn into cksc…
reshamas e8318fc
Merge branch 'main' of github.com:scikit-learn/scikit-learn into cksc…
reshamas 4e9a84c
added tests for alpha
reshamas cbafadf
adding tests for tol
reshamas 1e56683
added tests for verbose
reshamas a0c1055
remove extra checks for alpha and tol
reshamas d495edd
Merge branch 'main' of github.com:scikit-learn/scikit-learn into cksc…
reshamas ca2b8ef
remove default parameters in function call
reshamas 0bafb3b
remove default calls
reshamas 9a58697
add range
reshamas 9fb9ce8
Merge branch 'main' of github.com:scikit-learn/scikit-learn into cksc…
reshamas 569f510
Merge branch 'main' of github.com:scikit-learn/scikit-learn into cksc…
reshamas 4354567
fixing flake8 error
reshamas 0c17768
comment out tol=1 check
reshamas db18608
Merge branch 'main' of github.com:scikit-learn/scikit-learn into cksc…
reshamas 3ef2a20
add multiple estimators in parametrization
reshamas 414d605
Merge branch 'main' of github.com:scikit-learn/scikit-learn into cksc…
reshamas 0c62527
Update wording for interval range: "should be" to "must be"
reshamas 97ac32e
remove commented isinstance check
reshamas f9bc8a0
capitalize "estimator" to "Estimator"
reshamas 22f4962
remove commented portion for checking tol
reshamas 3f9b7a9
estimator should be "Estimator"
reshamas f94b36d
estimator should be "Estimator"
reshamas 2b765a5
for interval range, change from should to must
reshamas 861b805
Merge branch 'ckscalar_glm' of https://github.com/reshamas/scikit-lea…
reshamas 98b9484
Merge branch 'main' of github.com:scikit-learn/scikit-learn into cksc…
reshamas 3478713
Merge branch 'main' of github.com:scikit-learn/scikit-learn into cksc…
reshamas 9f04ec8
removing interval ranges; added to PR#22076
reshamas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
In general, we are not consistent here, but since the default is both, I think we can leave out
'left'
Also, this is consistent with the rest of this PR that leaves out
include_boundaries
.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.
@thomasjpfan Not sure I understand why we are leaving it "both" when it's "left"?
Uh oh!
There was an error while loading. Please reload this page.
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.
With
max_val
set toNone
, "left" and "both" means the same thing in terms of the upper bound because the upper bound is not checked.For
alpha
, I think it is technically "both" becausenp.inf
is a valid value foralpha
in the GLMs:Setting
alpha=np.inf
is strange, but it can be educational?Edit: In other words, should we distinguish between
[0.0, inf]
and[0.0, inf)
? Currently:check_scalar(..., min_val=0.0, include_boundaries="both")
check_scalar(..., min_val=0.0, include_boundaries="left")
both mean
[0.0, inf]
, where theinf
is included. Here is a snippet to show case thatnp.inf
passes both checks:Uh oh!
There was an error while loading. Please reload this page.
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 would say that most of the time in the docstring we should note
[0.0, inf)
to exclude inf as invalid.But there might be places where
np.inf
is a valid value for the parameter and has a special meaning and it should be documented what it does in the docstring.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.
BTW: for the Poisson regressor example with infinite alpha I get:
so rejecting it seems a good idea :)