Compute the L1 and L2 norms of a weight vector together with the matching penalty terms, to build intuition about sparsity and shrinkage.
L1 倾向稀疏,L2 倾向小权重。
| Item | Formula / Note | Source / Standard |
|---|---|---|
| L1 penalty | the L1 penalty adds the sum of absolute weights and yields sparse solutions | Tibshirani 1996, JRSS-B |
| L2 penalty | the L2 penalty adds the sum of squared weights and shrinks large weights | Hoerl & Kennard 1970, Technometrics |
| Strength coefficient | a larger penalty coefficient tightens the constraint and over-regularises when too large | Hastie et al., Elements of Statistical Learning |