0
$\begingroup$

I have a regression problem where I need all coefficents to be positive and the intercept to be zero. I can do this in sklearn but i don't understand how the algoritm can force this conditions through the loss function. Any references will be appreciated.

enter image description here

$\endgroup$
  • 5
    $\begingroup$ Lasso does not constrain parameters to be positive. $\endgroup$ – Tim Jan 6 at 15:17
0
$\begingroup$

Lasso does neither of those things. It forces the coefficients of the least important predictors to be zero, but not necessarily the intercept (this would be problem dependent). At the same time, since the loss function contains the absolute value of the coefficients, their sign is irrelevant and only their magnitude has an effect on the result.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.