-
Notifications
You must be signed in to change notification settings - Fork 115
Make allowrankdeficient a keyword argument
#386
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
Make allowrankdeficient a keyword argument
#386
Conversation
|
Tests fail for unrelated reasons. I will try and figure out and fix with another PR. This is ready for a review. |
|
Tests pass now, the "trim trailing whitespace" option in Sublime text was breaking the printing tests. Ready for a review. |
kleinschmidt
left a 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.
LGTM, other than a few comments on the tests
test/runtests.jl
Outdated
| 4.108734932819495, 4.995249696954908, 6.075962907632594, 0.0, 8.038151489191618, | ||
| 8.848886704358202, 2.8697881579099085, 11.15107375630744, 11.8392578374927]) | ||
|
|
||
| m2p_dep = fit(LinearModel, Xmissingcell, ymissingcell, true) |
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 add a test that this warns?
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.
and I guess maybe also the behavior when the kwarg and the positional conflict?
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.
Added!
src/glmfit.jl
Outdated
| end | ||
|
|
||
| function GlmResp(y::AbstractVector{<:Real}, d::D, l::L, off::AbstractVector{<:Real}, | ||
| function GlmResp(y::AbstractVector{<:Real}, d::D, l::L, off::AbstractVector{<:Real}, |
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.
can you revert all these whitespace changes so that the git blame is clean?
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.
Fixed.
src/lm.jl
Outdated
| if allowrankdeficient_dep != nothing | ||
| @warn "Positional argument `allowrankdeficient` is deprecated, use keyword" * | ||
| "argument instead. Proceeding with positional argument value: $allowrankdeficient_dep" | ||
| allowrankdeficient = allowrankdeficient_dep |
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.
| if allowrankdeficient_dep != nothing | |
| @warn "Positional argument `allowrankdeficient` is deprecated, use keyword" * | |
| "argument instead. Proceeding with positional argument value: $allowrankdeficient_dep" | |
| allowrankdeficient = allowrankdeficient_dep | |
| if allowrankdeficient_dep != nothing | |
| Base.depwarn("Positional argument `allowrankdeficient` is deprecated, use keyword" * | |
| "argument instead. Proceeding with positional argument value: $allowrankdeficient_dep", | |
| :fit) | |
| allowrankdeficient = allowrankdeficient_dep |
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 couldn't get this to work, I'll try again in a bit.
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.
Got it to work!
Codecov Report
@@ Coverage Diff @@
## master #386 +/- ##
==========================================
+ Coverage 79.56% 79.79% +0.23%
==========================================
Files 7 7
Lines 685 688 +3
==========================================
+ Hits 545 549 +4
+ Misses 140 139 -1
Continue to review full report at Codecov.
|
|
Thanks for the reviews. I responded to all comments. Ready for another round! |
|
By making this a keyword argument, the name |
Co-authored-by: Milan Bouchet-Valat <nalimilan@club.fr>
|
I also don't have any good suggestions. Stata and R do it by default, while it looks like python doesn't allow it at all. Would it be too breaking to make it |
|
AFAICT it wouldn't be breaking at all since it would turn an error into something that succeeds. @dmbates @andreasnoack Opinions? |
|
Okay just pushed a commit to
It also has an added performance benefit! Tests are updated. I haven't added anything to |
|
Ready for a review! |
|
Bumping this! Just fixed some errant white space changes. To recap: Changes |
|
LGTM. Nightly failures are due to the p-value printing thing with printfpocalypse (so unrelated) |
nalimilan
left a 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.
Looks good! Just a wording suggestion.
Co-authored-by: Milan Bouchet-Valat <nalimilan@club.fr>
pdeffebach
left a 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.
Thanks!
In reference to #351.
Whether or not
lmshould allow a rank deficient matrix is an option, andtrueorfalseis not an input value on its own. Therefore it makes sense that this be a keyword argument and not a positional argument.The docs are also improved.
No changes to
glmbecause I don't think any aspect ofglmallows rank deficient input matrices, even though it probably should. But thats another PR.