# glmnet

> R package that fits lasso and elastic-net regularized generalized linear models

Source: https://talira.ai/catalog/glmnet-xxq3nqh1
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [ai / ml / classical ml](https://talira.ai/categories/ai/ml/classical-ml), [languages / r](https://talira.ai/categories/languages/r)
- Licence: GPL-2.0-only[^1]
- Pricing: Free and open source[^1]
- Free tier: yes[^1]
- Backed by: [Trevor Hastie](https://talira.ai/orgs/trevor-hastie.md)

glmnet is an R package that fits the whole lasso or elastic-net regularization path for linear, multi-task Gaussian, logistic and multinomial, Poisson and Cox regression, using cyclical coordinate descent. It also takes any GLM family object, refits each active set unpenalized with the relax option, cross-validates with cv.glmnet, assesses models on test data (confusion matrices, ROC plots), builds model matrices with one-hot encoding and missing-value handling, and accepts sparse matrices. Version 5 rewrote its kernels in C++. Its authors include Jerome Friedman, Trevor Hastie and Rob Tibshirani, and a companion book covers it with worked examples.

## Links

- Website: https://glmnet.stanford.edu/
- Docs: https://glmnet.stanford.edu/reference/

## Problems it solves

- fit a lasso regression in R
- pick predictors automatically from hundreds of variables
- regularized logistic regression with cross-validation in R

## Features

- Fits the entire lasso or elastic-net path for linear, logistic, multinomial, Poisson and Cox models
- Any GLM family object as the family argument
- Relaxed fits that refit each active set without the penalty
- Cross-validation with cv.glmnet and assessment on test data
- Sparse matrix input and model-matrix helpers with one-hot encoding

## Trust

Overall: 0.41 out of 1.
Signals: maintenance 0.58, adoption 0.67, backing 0.30, extensibility 0.00.

- latest package release 33 days ago (CRAN glmnet 5.2)
- packages released for 18 years
- 235k package downloads a month (CRAN)
- backed by Trevor Hastie

## Alternatives

- [ranger (R)](https://talira.ai/catalog/ranger-r-aj79rspj.md): Fast random forests for R and C++, suited to high-dimensional data

## Sources

[^1]: https://cran.r-project.org/web/packages/glmnet/index.html (checked 28 Nov 2026)
