glum
High performance Python GLMs with all the features!
What it is and what it does
glum is a scikit-learn-compatible GLM library designed for speed and statistical completeness. It supports Normal, Poisson, binomial, gamma, inverse Gaussian, negative binomial, and Tweedie distributions with customizable link functions. The library includes L1, L2, and elastic net regularization, built-in cross-validation for regularization tuning, and classical statistical inference for unregularized models. It also supports box constraints, linear inequality constraints, sample weights, and offsets.
The package emphasizes formula-based model specification via formulaic, allowing users to define models with intuitive syntax including monotonic constraints. It works with multiple dataframe backends (pandas, polars, and others) through narwhals. Performance is a core design goal—the library is optimized for scenarios where observations greatly outnumber predictors, and includes benchmarking tools for comparison against other modern libraries.
Use it for:
- Build logistic regression models with L1 regularization for sparse, interpretable solutions in classification tasks
- Fit Poisson regression for count data in demand forecasting or event prediction
- Specify complex models with formulas including spline basis functions and categorical encoding without manual feature engineering
- Apply Tikhonov (matrix-valued) penalties to model correlated random effects in hierarchical data
- Perform statistical inference on unregularized GLM coefficients with confidence intervals and hypothesis tests
- Benchmark GLM fitting performance across libraries using the included glum_benchmarks module
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
glum is a high-performance Python library for fitting generalized linear models (GLMs) with support for multiple distributions, regularization methods, formula-based specification, and statistical inference.
Yes, if you need fast GLM fitting with broad distribution and regularization support and a scikit-learn-like API. The active maintenance, permissive license, and zero known vulnerabilities make it production-ready. Medium install friction is acceptable for the performance and feature gains. Verify performance on your specific problem size and distribution before committing to production use.
Install
glum on PyPI
pip
pip install glumuv
uv add glumpoetry
poetry add glumInstalling glum
Before you install
Medium install friction due to compiled wheels across multiple Python versions (3.10–3.13) and architectures. Active maintenance with recent releases; last commit 2026-08-03. Twelve runtime dependencies including numpy, scipy, scikit-learn, pandas, and pyarrow add some complexity, though all are widely available.
License in practice
BSD permissive license allows commercial and private use with minimal restrictions, making it suitable for most production and research contexts.
Quickstart
pip install glum
from glum import GeneralizedLinearRegressor
import pandas as pd
model = GeneralizedLinearRegressor(family='binomial', alpha=0.001)
model.fit(X, y)
predictions = model.predict(X_test)
Requires Python 3.10 or later. For optimal performance on x86_64, MKL library recommended (conda install mkl).
Verify before relying
- Specific performance gains versus scikit-learn or other GLM libraries on typical datasets
- Memory usage characteristics for large datasets
- Whether all documented distributions (Tweedie, negative binomial, etc.) are production-ready
Package facts
| License | BSD (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 12 — formulaic, joblib, narwhals, numexpr, numpy, packaging, pandas, pyarrow, scikit-learn, scipy, tabmat, tqdm |
| Maintenance | actively maintained — 100 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 330,902/month — #7,528 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: glum-3.4.1-cp310-cp310-macosx_10_13_x86_64.whl; glum-3.4.1-cp310-cp310-macosx_11_0_arm64.whl; glum-3.4.1-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; glum-3.4.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; glum-3.4.1-cp310-cp310-win_amd64.whl; glum-3.4.1-cp311-cp311-macosx_10_13_x86_64.whl; glum-3.4.1-cp311-cp311-macosx_11_0_arm64.whl; glum-3.4.1-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; glum-3.4.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; glum-3.4.1-cp311-cp311-win_amd64.whl; glum-3.4.1-cp312-cp312-macosx_10_13_x86_64.whl; glum-3.4.1-cp312-cp312-macosx_11_0_arm64.whl; glum-3.4.1-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; glum-3.4.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; glum-3.4.1-cp312-cp312-win_amd64.whl; glum-3.4.1-cp313-cp313-macosx_10_13_x86_64.whl; glum-3.4.1-cp313-cp313-macosx_11_0_arm64.whl; glum-3.4.1-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; glum-3.4.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; glum-3.4.1-cp313-cp313-win_amd64.whl
Tags
More Mathematics packages
NetworkX provides data structures and…
permissive · top 1,000 on PyPI
kiwisolverkiwisolver is a Python binding to a fast C++…
permissive · top 1,000 on PyPI
sympySymPy is a Python library for symbolic…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
torchPyTorch provides GPU-accelerated tensor…
permissive · top 1,000 on PyPI
onnxruntimeonnxruntime loads and executes Open Neural…
permissive · top 1,000 on PyPI
spglmFits Gaussian, Poisson, QuasiPoisson, and…
permissive · top 15,000 on PyPI
dask-glmDistributed generalized linear model fitting…
permissive · top 15,000 on PyPI
statsmodelsstatsmodels provides statistical models,…
permissive · top 1,000 on PyPI
pyfixestPyFixest performs fast high-dimensional fixed…
permissive · top 15,000 on PyPI
lmfitLmfit provides non-linear least-squares…
permissive · top 5,000 on PyPI
linearmodelsProvides panel regression, instrumental…
unclear · top 15,000 on PyPI
mgwrCalibrates multiscale and traditional…
permissive · top 15,000 on PyPI
pysalPySAL is a meta-package that bundles 29 spatial…
permissive · top 15,000 on PyPI
aplrAPLR builds interpretable regression and…
permissive · top 15,000 on PyPI
pyglmPyGLM provides Python bindings to OpenGL…
permissive · top 15,000 on PyPI