L1 penalties
An L1-penalized objective adds λ times the absolute-value sum of its penalized coefficients to data loss.
On this page 7 sections
01An L1 penalty adds the absolute sizes of the penalized coefficients#
An L1 penalty adds the absolute sizes of the penalized coefficients. Positive and negative coefficients both add cost:
L is the data loss and λ is a nonnegative penalty weight.
For loss 3, w=(−2,1) and λ=2, the absolute values sum to 3. Penalty 6 gives a total objective of 9.
J=L+λ||w||₁. Given L=2, λ=2, w=. Find J.
Show answer and explanation
Absolute values sum to 5; total 12.
02A candidate with lower data loss can still have a higher penalized objective#
A candidate with lower data loss can still have a higher penalized objective. Compute loss plus penalty for each candidate using the same λ.
The result is one scalar score. Coefficient sign cancellation would incorrectly erase part of the penalty.
Compare J=L+λ||w||₁, λ=1. A: L=2, w=. B: L=3, w=. Lower J?
Show answer and explanation
J_A=5, J_B=4.
03Only explicitly penalized coefficients belong in the sum#
Only explicitly penalized coefficients belong in the sum. If the intercept is excluded, its size must not affect this penalty.
Absolute value also has a kink at zero. L1 penalties are not differentiable everywhere; a separate treatment handles that point.
J=L+λ||w||₁; intercept b is excluded. L=4, λ=2, b=-3, slopes w=. Draft J=16 includes b. Correct J.
Show answer and explanation
Only slopes are penalized; J=10.
Take absolute values, respect excluded coefficients, multiply by λ and add the data loss.
- Compute an L1-penalized objective for supplied coefficients.
Sources & further reading
- [1]Parikh & Boyd §7.1 Lasso and §6.5.2 ↗Parikh & Boyd §7.1 Lasso and §6.5.2 · Article