Home

glmnet

glmnet is a software package for fitting generalized linear models with elastic-net regularization. It computes the entire regularization path for a sequence of penalty parameters lambda using a fast coordinate-descent algorithm, enabling efficient fitting even when the number of predictors p is large. The package supports multiple model families, including Gaussian (linear regression), binomial (logistic regression), Poisson, multinomial, and Cox proportional hazards models, covering a broad range of regression and classification tasks.

Regularization is controlled by alpha in [0,1], where alpha=1 corresponds to lasso (L1 penalty) and alpha=0 to

The glmnet function returns an object containing the fitted coefficients for all lambda values, the intercepts,

glmnet is open-source, with code primarily in Fortran and an R interface, and is widely used in

ridge
(L2
penalty).
Intermediate
values
provide
elastic-net
penalties.
Predictors
are
standardized
by
default
and
an
intercept
is
included
unless
requested
otherwise.
The
lambda
sequence
can
be
chosen
automatically
or
supplied
by
the
user.
The
method
is
well
suited
to
high-dimensional
data
and
can
handle
correlated
predictors
due
to
the
ridge
component
in
the
elastic-net
penalty.
the
lambda
grid,
and
fit
diagnostics
such
as
the
deviance
and
degrees
of
freedom.
Predictions
and
plotting
can
be
performed
with
predict.glmnet
and
plot.glmnet,
and
cross-validation
can
be
conducted
with
cv.glmnet
to
select
lambda_min
or
lambda_1se.
statistics
and
machine
learning
for
regularized
regression
and
classification.
It
originated
from
the
work
of
Jerome
Friedman,
Trevor
Hastie,
and
Robert
Tibshirani
and
is
distributed
under
an
open-source
license.