# Why non-differentiable regularization lead to setting coefficients to 0?

The L2 regularization lead to minimize the values in the vector parameter. The L1 regularization lead to setting some coefficients to 0 in the vector parameter.

More generally, I've seen that non-differentiable regularization function lead to setting coefficients to 0 in the parameter vector. Why is that the case?

• Jul 27, 2021 at 3:10
• @BenReiniger There is some additional value here: the generalization of L1 to "non differentiable" regularization. I was well aware of L1 but not the general case. May 20, 2023 at 14:07
• @WestCoastProjects fair, but I think the general intuition is the same (e.g. L_alpha "norms" with alpha between 0 and 2)...except when it's false, e.g. using the infinity-norm would put the sharp corners of the constraint region along $x_1=x_2$ and thus encourage non-sparse solutions! May 20, 2023 at 14:46

Look at the penalty terms in linear Ridge and Lasso regression:

Ridge (L2):

Lasso (L1):

Note the absolute value (L1 norm) in the Lasso penalty compared to the squared value (L2 norm) in the Ridge penalty.

In Introduction to Statistical Learning (Ch. 6.2.2) it reads: "As with ridge regression, the lasso shrinks the coefficient estimates towards zero. However, in the case of the lasso, the L1 penalty has the effect of forcing some of the coefficient estimates to be exactly equal to zero when the tuning parameter λ is sufficiently large. Hence, much like best subset selection, the lasso performs variable selection."

http://www-bcf.usc.edu/~gareth/ISL/

• This, I know already, I'm asking why that is the case, more like a mathematical intuition or proof. Jul 1, 2019 at 9:09
• I thought you can directly see it from the math: Have a look at this page (Section: Comparing regularization techniques — Intuition). It's all about the norms (L1 vs. L2) blog.alexlenail.me/… Jul 1, 2019 at 11:39
• This is not answering the question about the general case of non-differentiable regularization functions. If that reference answers it then an excerpt would helpfully be included above May 20, 2023 at 14:08

ISLR talks about this topic in details, it can be understood by looking Contours of error and loss function given in the image below:

Each of the ellipses centered around βˆ represents a contour: this means that all of the points on a particular ellipse have the same RSS value. As the ellipses expand away from the least squares coefficient estimates, the RSS increases. Equations (6.8) and (6.9) indicate that the lasso and ridge regression coefficient estimates are given by the first point at which an ellipse contacts the constraint region. Since ridge regression has a circular constraint with no sharp points, this intersection will not generally occur on an axis, and so the ridge regression coefficient estimates will be exclusively non-zero. However, the lasso constraint has corners at each of the axes, and so the ellipse will often intersect the constraint region at an axis. When this occurs, one of the coefficients will equal zero. In higher dimensions, many of the coefficient estimates may equal zero simultaneously

For orthogonal features you can show with sub derivative methods that $$\hat\beta_{j}^{\text{Lasso}}=\hat\beta_{j}^{\!\;\text{OLS}} \max \Biggl( 0, 1 - \frac{ N \lambda }{ \bigl|\hat\beta{}_j^{\!\;\text{OLS}}\bigr| } \Biggr)$$. Here you see that some regression coefficients are set to exactly 0. People call this the soft thresholding operator. The proof with sub derivatives is needed since the absolute function has no normal derivative.