9.2

3 Examples🔗

Each example below is a literate program: the prose and the code you see are the same source that lives in the package’s "glmnet/examples/" directory and is exercised by the test suite under "glmnet/examples/test/". Every example provides a run-example thunk, so you can run any of them directly or read them as documentation that is guaranteed to stay in sync with the code.

    3.1 Ordinary least squares (λ = 0)

    3.2 Ridge regression (L2, α = 0)

    3.3 Lasso (L1, α = 1)

    3.4 Elastic net (0 < α < 1)

    3.5 Binomial logistic regression (classification)

    3.6 Multinomial classification (K classes)

    3.7 Cox proportional hazards (survival)

    3.8 Poisson regression (counts)

    3.9 Multi-response Gaussian (grouped)