Regularization of Generalized Linear Models

Overview

We can understand regularization as an approach of adding an additional bias to a model to reduce the degree of overfitting in models that suffer from high variance. By adding regularization terms to the cost function, we penalize large model coefficients (weights); effectively, we are reducing the complexity of the model.

L2 regularization

In L2 regularization, we shrink the weights by computing the Euclidean norm of the weight coefficients (the weight vector ); is the regularization parameter to be optimized.

For example, we can regularize the sum of squared errors cost function (SSE) as follows:

Intuitively, we can think of regression as an additional penalty term or constraint as shown in the figure below. Without regularization, our objective is to find the global cost minimum. By adding a regularization penalty, our objective becomes to minimize the cost function under the constraint that we have to stay within our "budget" (the gray-shaded ball).

In addition, we can control the regularization strength via the regularization parameter . The larger the value of , the stronger the regularization of the model. The weight coefficients approach 0 when goes towards infinity.

L1 regularization

In L1 regularization, we shrink the weights using the absolute values of the weight coefficients (the weight vector ); is the regularization parameter to be optimized.

For example, we can regularize the sum of squared errors cost function (SSE) as follows:

At its core, L1-regularization is very similar to L2 regularization. However, instead of a quadratic penalty term as in L2, we penalize the model by the absolute weight coefficients. As we can see in the figure below, our "budget" has "sharp edges," which is the geometric interpretation of why the L1 model induces sparsity.

References