skillfed

glum

High performance Python GLMs with all the features!

glum v3.4.1 330.9K downloads/30d#7,528 on PyPI382
Permissive license BSD Active released

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 glum

uv

uv add glum

poetry

poetry add glum

Installing 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

Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13

Tags

generalized linear models pythonGLM regression librarylogistic regression with regularizationpoisson regression pythonfast GLM fittingformula-based model specificationL1 L2 elastic net regularization
statistical-modelingregularizationformula-based

More Mathematics packages

Further reading