liveBook · Manning

L1 regularization

As explained in Grokking Machine Learning

L1 regularization adds the L1 norm of a model's non-bias coefficients as a complexity penalty to its regression error.

L1 regularization adds the sum of the absolute model coefficients to regression error, penalizing complexity during training. This is also called lasso regression. The penalty can shrink coefficients to zero, making it useful when many features may be unnecessary. section 4.5 section 4.7

Lasso regression error = Regression error + L1 norm

The lasso objective combines regression error with the L1 norm; a regularization parameter can control the penalty’s weight. section 4.5

Unlike L2 regularization, which tends to make coefficients small without setting them to zero, L1 can eliminate coefficients. The choice depends on the goal: L1 is recommended for many features when turning some into zero is desirable. section 4.5 section 4.7

Polynomial regression with Turi Create

A polynomial model built from 200 columns is trained with l1_penalty=0.1 and l2_penalty=0. The L1 model performs reasonably on training and testing data, while the unregularized model fits training data well but generalizes poorly. section 4.6

How Grokking Machine Learning covers it

How deep it goes
Defines the L1 penalty, explains coefficient shrinkage, and compares polynomial-model results without deriving the optimization procedure.
Examples
Compares regularized polynomial models using a 200-column dataset and contrasts their training and testing performance.
What it assumes
Assumes familiarity with regression error and model coefficients while defining complexity through coefficient norms.
What you can do after
Apply L1 regularization through Turi Create’s linear_regression.create by setting l1_penalty.
How it connects
Connects lasso to regression error, overfitting, L2 regularization, ridge regression, and polynomial regression.

Also explained in

Compare how 6 books explain L1 regularization →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Machine Learning. The section links point to the parts of the book it draws on.