-
Notifications
You must be signed in to change notification settings - Fork 116
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
Allow for sparse arrays and views #446
Conversation
36d7726
to
6059527
Compare
The CI failures indicate that we use different code paths for actual computations with and without views (the differences are roudoff errors). This is surprising. What is the reason? |
In general I am OK to close my PR and finalize this. Thank you! |
I agree. I expected them to take the same code path and therefore be exactly equal. I'll try figure out what is going on. |
@andreasnoack - what is still needed in this PR to merge it? |
There is some strange test failure on Julia 1.0 (I would assume that the failing |
That failure is indeed weird. I wonder whether it happens at random or whether it's something specific to Julia 1.0 on Mac. |
Codecov Report
@@ Coverage Diff @@
## master #446 +/- ##
==========================================
+ Coverage 84.01% 84.12% +0.11%
==========================================
Files 7 7
Lines 807 819 +12
==========================================
+ Hits 678 689 +11
- Misses 129 130 +1
Continue to review full report at Codecov.
|
I can reproduce this locally with Julia 1.0 julia> coef(glm(X, y, Normal(), IdentityLink()))
2-element Array{Float64,1}:
0.9999999999999999
1.0
julia> coef(glm(view(X, 1:9, :), view(y, 1:9), Normal(), IdentityLink()))
2-element Array{Float64,1}:
1.0
1.0 I don't know why the two versions are taking a different code path somewhere. If somebody has any idea then I'd like to hear it. |
This also fails on Julia 1.7 so I'll try to figure out where the divergence is happening. |
There is the same problem for julia> coef(lm(X, y))
2-element Array{Float64,1}:
1.0
1.0000000000000004
julia> coef(lm(view(X, 1:9, :), view(y, 1:9)))
2-element Array{Float64,1}:
0.9999999999999999
1.0
julia> coef(glm(X, y, Normal(), IdentityLink()))
2-element Array{Float64,1}:
0.9999999999999999
0.9999999999999999
julia> coef(glm(view(X, 1:9, :), view(y, 1:9), Normal(), IdentityLink()))
2-element Array{Float64,1}:
0.9999999999999999
1.0 |
e60eb3b
to
0ba977b
Compare
So this turned out to be pretty dumb. The view was |
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 please also bump package version number in this PR and make a release after this?
Thank you!
Good! Though it looks like my suggestions got reverted. |
0ba977b
to
8893f42
Compare
Hm. Thanks for catching that. I tried to squash the intermediate commits while rebasing on master and I must somehow have ended up reverting those changes while doing that. I've reintroduced your suggestions. |
I've now also included the tests from #466 and bumped the version. |
Co-authored-by: Milan Bouchet-Valat <nalimilan@club.fr>
This is an alternative to #443 as discussed in that PR. I'm converting the inputs to
Vector
since we don't really support anything else even though the structs are parametric. Eventually, we can consider loosening this conversion if we want to support e.g.CuArrays
but it would have to be a more extensive rewrite to ensure that things work and that no slow paths are hit in important cases so, for now, I think this PR is the best way forward. cc @bkamins