Lasso Regression – Understanding Sign Changes in Lasso and Ridge Coefficients

lassologisticmachine learningregularizationridge regression

I am estimating in total three models: Logistic regression without any penalization (as benchmark model), logistic regression with L1 penalization (LASSO) and with L2 penalization (RIDGE). Now i recognize that the coefficients compared to the benchmark model sometimes flip the sign. Is this a possible effect? – Up to now I only thought they could be zero (LASSO) or go towards zero (RIDGE).

Thanks.

Best Answer

Both methods will drive your weights towards zero, but they do not differentiate between positive and negative values. Just look at the penalty values for two potential weights, for example -10 and 10:

L2: The penalty is w^2 for a weight w, and (-10)^2 = (10^2) = 100

L1: The penalty is |w| for a weight w, and |-10| = |10| = 10

So both terms will lower the values of your weights, but will not prevent them from being negative.