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

convert all eltypes of GlmResp args to the eltype of the first #369

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dsweber2
Copy link

min example: GLM.GlmResp(randn(10), Binomial(), LogitLink(), randn(Float32, 10), randn(10)) Gets stuck in a loop because float won't convert Float64 and Float32 to the same type. I just turned the first one into a float, and then made the rest match that type of float explicitly.

@dsweber2
Copy link
Author

digging a bit further, it seems the problem I was trying to address with this was actually caused in Lasso.jl, which was inconsistent about handing Float32 and Float64 to GLM.jl. I think this pull is still worth changing, but there are several changes elsewhere that are also needed if the input is somewhat inconsistent about the type of float involved.

@nalimilan
Copy link
Member

Thanks. Though note that float only makes a copy when necessary, contrary to what would happen with this PR. Can you change it to use convert instead? Also better use promote_type to choose the appropriate destination type.

getzze added a commit to getzze/RobustModels.jl that referenced this pull request Jun 2, 2023
* ensure same eltype for X and y (JuliaStats/GLM.jl#369)

* correctly use QR

* use :cholesky and dropcollinear like in GLM

* test method :cholesky

* create own DensePredQR

* cleanup
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.

2 participants