Lasso fit with non-negative coefficients

Hi
I am using a Lasso model for feature selection. At present I use the function

lassoFit = fit(LassoPath, X_train, Y_train, λ = lamGrid, maxncoef=maxncoef)

I have the following question.

(1) Some estimated coefficients are negative for each lamGrid value, which don’t give a reasonable biological meaning to my problem. I need all coefficients to be non-negative. Is there a way to restrict the coefficients to be non-negative?

Thanks

You may need to mention which package you’re talking about.

2 Likes

@baggepinnen , I use the lasso package Lasso paths · Lasso.jl.
Also, how is the out put pct_dev computed in the package?
Thanks

It seems like GLMNet.jl supports the constraints keyword that you can use.

@biona001 Thanks for the suggestion. It worked with the GLMNet.jl