3.3 Lasso (L1, α = 1)
The lasso is the elastic net at α = 1: a pure L1 penalty. Where
ridge shrinks every coefficient but keeps them all, the lasso performs
variable selection —
Using the same fixture —
(require glmnet)
(provide run-example)
(define X '((1.0 2.0 1.0) (2.0 1.0 4.0) (3.0 4.0 9.0) (4.0 3.0 16.0) (5.0 6.0 25.0) (6.0 5.0 36.0))) (define y '(1.0 4.0 3.0 6.0 5.0 8.0))
lasso is elnet-fit with #:alpha 1.0. The third
coefficient comes back exactly 0.0 —