Skip to content
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

Open
wants to merge 9 commits into
base: v1
Choose a base branch
from
Open

backport of QR to 1.x #537

wants to merge 9 commits into from

Conversation

palday
Copy link
Member

@palday palday commented Jun 7, 2023

from #507

mousum-github and others added 7 commits June 7, 2023 12:01
backport of #507

---------

Co-authored-by: Mousum <[email protected]>
Co-authored-by: ayushpatnaikgit <[email protected]>
Co-authored-by: Milan Bouchet-Valat <[email protected]>
Co-authored-by: Ayush Patnaik <[email protected]>
Co-authored-by: harsharora21 <[email protected]>
Co-authored-by: Bogumił Kamiński <[email protected]>
(cherry picked from commit a8016bd)
@codecov
Copy link

codecov bot commented Jun 7, 2023

Codecov Report

Patch coverage: 86.79% and project coverage change: +0.72 🎉

Comparison is base (6406a70) 87.39% compared to head (cd187fb) 88.11%.

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     
Impacted Files Coverage Δ
src/GLM.jl 60.00% <50.00%> (+10.00%) ⬆️
src/negbinfit.jl 81.81% <66.66%> (-0.85%) ⬇️
src/linpred.jl 88.55% <83.63%> (+2.94%) ⬆️
src/lm.jl 94.07% <97.14%> (+0.74%) ⬆️
src/glmfit.jl 81.33% <100.00%> (+0.31%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

test/runtests.jl Outdated Show resolved Hide resolved
test/runtests.jl Outdated Show resolved Hide resolved
@nalimilan
Copy link
Member

Is there any particular place we should look at (i.e. where you had to adapt the original PR)?

@palday
Copy link
Member Author

palday commented Jun 7, 2023

@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 fit(::Type, ::FormulaTerm,...)) method, I accepted all changes from the original PR. The follow-up modifications were related to the additional redirection from TableRegressionModel.

Copy link
Member

@nalimilan nalimilan left a 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


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intentional?

Copy link
Member Author

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.

Copy link
Member

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
Copy link
Member

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)
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member Author

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.

Copy link
Member

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 AbstractGLMs or TableRegressionModels.

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
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intended?

@nilshg
Copy link

nilshg commented Nov 18, 2024

What's the status of this? The 1.9 release notes mention that QR is now available, but that doesn't actually seem to be the case?

@palday
Copy link
Member Author

palday commented Nov 20, 2024

The automatically generated release notes just indicate that a certain PR has been merged, not that it's part of the release. The QR decomposition is available on trunk, but it's not been back ported to the 1.x series. We've been putting off a 2.0 release for a few reasons, but maybe we can go ahead and release it.

@nilshg
Copy link

nilshg commented Nov 21, 2024

Any reason why it's not being backported? As far as I can tell this could just be a feature release, as Cholesky would remain the default?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants