# Python implementation of regularized generalized linear models¶

Pyglmnet is a Python 3.5+ library implementing generalized linear models (GLMs) with advanced regularization options. It provides a wide range of noise models (with paired canonical link functions) including gaussian, binomial, probit, gamma, poisson, and softplus. It supports a wide range of regularizers: ridge, lasso, elastic net, group lasso, and Tikhonov regularization.

[Repository] [Documentation (stable release)] [Documentation (development version)]

## A brief introduction to GLMs¶

For linear models specified as

The parameters \(\beta_0, \beta\) are estimated using ordinary least squares, under the implicit assumption that \(y\) is normally distributed.

Generalized linear models allow us to generalize this approach to point-wise nonlinearities \(q(\cdot)\) and corresponding exponential family noise distributions for \(\epsilon\).

Regularized GLMs are estimated by minimizing a loss function specified by the penalized negative log-likelihood. The elastic net penalty interpolates between the L2 and L1 norm. We solve the following optimization problem:

where \(\mathcal{P}_2\) and \(\mathcal{P}_1\) are the generalized L2 (Tikhonov) and generalized L1 (Group Lasso) penalties, given by:

where \(\Gamma\) is the Tikhonov matrix: a square factorization of the inverse covariance matrix and \(\beta_{j,g}\) is the \(j\) th coefficient of group \(g\).

## Contents¶

## Questions / Errors / Bugs¶

If you have questions about the code or find errors or bugs, please report it here. For more specific questions, feel free to email us directly.