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

Package fails when response is zero vector. #51

Open
barankarakus opened this issue Aug 18, 2020 · 0 comments · May be fixed by #53
Open

Package fails when response is zero vector. #51

barankarakus opened this issue Aug 18, 2020 · 0 comments · May be fixed by #53

Comments

@barankarakus
Copy link
Contributor

Running the following

`
using Lasso

X = [1 2; 3 4]
y = zeros(2)
fit(LassoPath, X, y)
`

leads to the error message

ERROR: coordinate descent failed to converge in 10000 iterations at λ = NaN

Having done some debugging, the problem is the following: when computing the λ values that make up the path, λmax is computed to be 0, resulting in λ being a vector of NaNs. The correct thing to output is that the null model is the only Lasso solution.

The easiest way to fix this is to have a check for λ being a vector of all NaNs right after line 490 in Lasso.jl. This is not a good solution, though, since we're relying on the fact that λmax = 0 implies λ is a vector of all NaNs; λ may be a vector of all NaNs due to another reason.

I think the best solution will be to modify build_model so that, in addition to the 4 values it currently returns, it also returns λmax. Then, we can have a check for λmax == 0 in line 491.

@barankarakus barankarakus linked a pull request Sep 6, 2020 that will close this issue
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 a pull request may close this issue.

1 participant