-
Notifications
You must be signed in to change notification settings - Fork 114
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
backport of QR to 1.x #537
base: v1
Are you sure you want to change the base?
Conversation
backport of #507 --------- Co-authored-by: Mousum <mousum@spotle.ai> Co-authored-by: ayushpatnaikgit <ayushpatnaik@gmail.com> Co-authored-by: Milan Bouchet-Valat <nalimilan@club.fr> Co-authored-by: Ayush Patnaik <u6012645@anu.edu.au> Co-authored-by: harsharora21 <harsharora1337@gmail.com> Co-authored-by: Bogumił Kamiński <bkamins@sgh.waw.pl> (cherry picked from commit a8016bd)
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## v1 #537 +/- ##
==========================================
+ Coverage 87.39% 88.11% +0.72%
==========================================
Files 7 7
Lines 952 1077 +125
==========================================
+ Hits 832 949 +117
- Misses 120 128 +8
☔ View full report in Codecov by Sentry. |
Co-authored-by: Mousum Dutta <44145580+mousum-github@users.noreply.github.com>
Is there any particular place we should look at (i.e. where you had to adapt the original PR)? |
@nalimilan if you look at the diff excluding the first commit, then you can see things that were non obvious in the cherry-pick -- one exception (not including a local |
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. Just a few comments then. There are also lines that are not covered by tests, are these real?
@@ -79,11 +79,14 @@ Using a `CategoricalVector` constructed with `categorical` or `categorical!`: | |||
```jldoctest categorical | |||
julia> using CategoricalArrays, DataFrames, GLM, StableRNGs | |||
|
|||
|
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.
Is this intentional?
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 what doctest
updated things to.
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.
Weird... :-/
@@ -139,7 +142,8 @@ function negbin(F, | |||
regmodel = glm(F, D, NegativeBinomial(θ), args...; | |||
dropcollinear=dropcollinear, method=method, maxiter=maxiter, | |||
atol=atol, rtol=rtol, verbose=verbose, kwargs...) | |||
μ = regmodel.rr.mu | |||
|
|||
μ = _rr(regmodel).mu |
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.
Above the code seems to assume that regmodel
is a TableRegressionModel
, so you could just do regmodel.model.rr.mu
and remove _rr
.
GLM.Link(m::GeneralizedLinearModel) = Link(m.rr) | ||
Link(r::GlmResp) = r.link | ||
Link(m::GeneralizedLinearModel) = Link(m.rr) | ||
Link(m::StatsModels.TableRegressionModel{<:GeneralizedLinearModel}) = Link(m.model) |
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'm a bit surprised that you need to add this, as usually method delegations were only done in StatsModels, for functions from StatsAPI. For example, below Distribution
isn't defined for TableRegressionModel
. Where is this method called from?
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.
Link
is owned by GLM.
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.
They're called in the tests.
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.
Yeah but I wonder why we never needed this kind of definition before. I think the code was designed so that we never called functions on objects which could either be AbstractGLM
s or TableRegressionModel
s.
Maybe this doesn't matter much as 1.x is a dead-end anyway.
@test coef(gm1) == coef(gm2) ≈ [10, 1] | ||
end | ||
|
||
@testset "formula accessor" begin |
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 accessor isn't introduced by the PR, right? Why are tests added then?
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.
They were part of the cherry-picked commit.
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 don't see it at https://github.com/JuliaStats/GLM.jl/pull/507/files. I think this comes from the commit which removed TableRegressionModel
, which isn't relevant here.
end | ||
|
||
|
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.
Intended?
from #507