# l1 and l2 regularizations [duplicate]

What do the red ellipses mean to us in the chart below? Does it have a relationship with RMSE values?

Figure 3.11 from Elements of Statistical Learning by Hastie, Tibshirani, and Friedman

• This is copied from a book or paper apparently, and without knowing the context of the book it's impossible to say. May 15 '20 at 12:03
• – Sycorax
May 16 '20 at 18:58
• Does this answer your question? Why L1 norm for sparse models in particular, the answer which includes the exact same diagram
– Sycorax
May 16 '20 at 18:59

The ellipses are the level sets of the loss function, which would be square loss (the loss function in OLS), which looks like an up-opening parabola that is spun around. Here is the equation for the simple linear regression depicted in your image.

$$L(y,\hat{\beta})=\sum_{i=1}^n \bigg( y_i-\big(\hat{\beta}_0+\hat{\beta}_1x_i\big)\bigg)^2$$

Yikes! But it’s actually not that bad because:

1) A computer is going to do the heavy lifting.

2) It just means the sum of the squared residuals. (Do you see why?)

The level sets are the shapes formed by intersecting horizontal planes with the function. Think about slicing a bowl this way; it would be a bunch of circles. Now compress the bowl so it’s rim is elliptical instead of circular; the slices are ellipses.

Note that L1 and L2 regularization apply in more generality than a regression that uses square loss. You can regularization in GLMs like logistic regression, for instance.

• If there are n points in the validation data, should I consider these ellipses as graphic representation of the residues of these points? I may have asked with mixed and incomplete information, sorry. May 15 '20 at 14:28
• The $n$ refers to the points in the training set you then find the $\beta$ giving the smallest value of the loss function. (In OLS, that is the familiar $\beta=(X^TX)^{-1}X^T$.) So no, the ellipses have nothing to do with the points in the validation set, and the number of ellipses has nothing to do with the number of points used for training. Are you familiar with either loss functions or multivariable calculus? (Univariate calculus?)
– Dave
May 15 '20 at 15:00
• When I say residues, I actually meant the loss function value. thanks for the explanation and help. Yes, I'm familiar with the topics, but sometimes it can get confused. May 16 '20 at 9:55