JamesYang007 / adelie

A fast and flexible Python package for solving group lasso and elastic net problems.
https://jamesyang007.github.io/adelie/
MIT License
13 stars 0 forks source link

Change API with `dtype` in `glm`? #93

Closed JamesYang007 closed 2 months ago

JamesYang007 commented 2 months ago

There's been multiple occasions when we run into constructor issues when using float32 types in GLM objects because despite the response being a numpy array with float32, the dtype argument to GLM functions (which defaults to float64) casts it. The reason for having this argument is for cases like binomial or poisson where we need to explicitly specify it.

Proposed change: whenever possible, we should infer dtype from the given y. Even in binomial or poisson, the user may provide it with float types rather than integer types. Default to dtype is None. If we cannot infer, we raise an error telling the user to explicitly provide dtype to be np.float32 or np.float64.