Changelog
Unreleased
Bug fix:
- Fixed the check that
P2is positive semi-definite rejecting valid matrices, such as graph Laplacians, whose smallest eigenvalue is zero. The tolerance for eigenvalues that are negative due to rounding errors now scales with the size and magnitude ofP2. Also fixed the check crashing for sparseP2matrices with 2000 or more rows. - Fixed the line search of the IRLS solvers rejecting good steps near the optimum of L1-penalized or bounded problems. When the change in the objective was too small to measure, it compared the L1 norm of the gradient, which does not vanish at the optimum of such problems. It now compares the minimum-norm subgradient, the quantity the convergence check uses.
Other changes:
- Sped up the inner coordinate descent of the
irls-cdsolver about 3x forfloat64and 5x forfloat32data, with bitwise identical results. The gradient update after each coordinate move now runs on a contiguous copy of the active set's gradient instead of indexing through the active set, so the compiler vectorizes it. - Sped up the
irls-cdsolver for problems with collinear features, most commonly full one-hot encoded categoricals (drop_first=False, the default) next to an intercept or to each other. Coordinate descent could only creep along the directions in which the model does not change, so inner solves often ran up tomax_inner_iter. If an inner solve has not converged after 20 cycles, it now looks for such directions and moves along them exactly. On a Poisson lasso with three 50-level categoricals, this cuts the fit time from 32 seconds to 1.7 seconds, and from 220 seconds to 1.7 seconds with an elastic net penalty. Problems without such directions are not affected. Coordinate descent did not convergewarnings now come from the solver instead of the Cython kernel and show the value ofmax_inner_iter.- Declared the Cython extensions free-threading compatible, built free-threaded wheels, and added a
py314ttest environment.
3.5.0 - 2026-11-16
Bug fix:
- Fixed
categorical_levels_for polarsCategoricalcolumns not matching the design matrix columns. This could cause wrong predictions or errors inpredict. - Fixed
monotonic_constraintsraisingValueErrorwhen a formula term contains square brackets, e.g.bs(x, knots=[15, 20, 30]). - Fixed
monotonic_constraintsnot giving a monotone fitted effect when the first spline basis or categorical level is dropped, e.g. forbs()withoutinclude_intercept=TrueorC()withdrop_first=True. Detecting the droppedbs()basis requires tabmat 4.3.0, which recordsspans_intercept, so the minimum tabmat version is now 4.3.0. - Fixed a pandas deprecation warning being emitted before the "unseen categories"
ValueErrorwhen predicting on data with unseen categories. - Fixed the solver for
monotonic_constraintscomparing objective values computed with different constraint penalties in its line search. This caused spurious "Line search failed" convergence warnings and extra iterations. - The "Line search failed"
ConvergenceWarningis no longer emitted when the loss no longer changes up to machine precision, since users cannot act on it. - Replaced the "Sigmoid function too close to 0 or 1. Clipping." warning of the logit and cloglog links by a warning after the final fit. The old warning was emitted for single observations and intermediate solver iterations, which users cannot act on. The new warning is only emitted if more than 1% of the fitted values are numerically 0 or 1, which typically indicates (quasi-)perfect separation (for the cloglog link, only fitted values of 0 count, because values of 1 are routine). It suggests more regularization or removing the separating features.
- Fixed tabmat's "Input array is not contiguous; making a copy." warning being emitted for row slices of pandas data frames, e.g.
df.iloc[:n], infit,predictandscore. tabmat itself no longer emits this warning after 4.3.1. - Fixed
monotonic_constraintsordering the levels of an ordered categorical by their label (e.g. alphabetically) instead of by the category order. monotonic_constraintsnow raises aValueErrorfor unordered categoricals, and forcr()andcs()splines, instead of silently failing to enforce monotonicity.
Other changes:
- Removed scikit-learn from build dependencies.
- Warnings are now treated as errors in the test suite and in the README doctest in CI, except in the
nightlyandoldiesenvironments. - The documentation build now treats warnings as errors and runs in CI. Fixed the docstring formatting of
cat_missing_methodandget_linkand several broken links in the tutorials and the changelog. - Require Python>=3.11, since conda-forge no longer supports Python 3.10. No Python 3.10 wheels are built or uploaded to PyPI any more.
- Added
py314andpy315test environments, and a conda package build for Python 3.15. - Removed the
py310test environment and moved theoldiesenvironment and the conda package builds from Python 3.10 to 3.11, since conda-forge no longer supports Python 3.10. Theoldiespins for pandas (1.5), scikit-learn (1.1.3) and scipy (1.9) were raised to the oldest releases with Python 3.11 builds.
3.4.1 - 2026-05-06
Bug fix:
- Fixed
monotonic_constraintsraisingValueErrorwithdrop_first=Trueon categorical factors. - Fixed pickle compatibility for models saved before
monotonic_constraintswas added.
3.4.0 - 2026-04-27
New feature:
- Added
monotonic_constraintsparameter toGeneralizedLinearRegressorandGeneralizedLinearRegressorCVfor enforcing monotonic effects on splines, ordered categoricals, and interactions via the formula interface. Uses a newirls-ls-monotonicsolver (5-20× faster thantrust-constron insurance benchmark).
3.3.0 - 2026-04-14
New feature:
GeneralizedLinearRegressorCVnow exposestrain_deviance_path_, an array of shape(n_folds, n_l1_ratios, n_alphas)with the training-set deviance.
Other changes:
- Replaced the
hess="2-point"finite-difference Hessian in thetrust-constrsolver withSR1()(quasi-Newton), significantly speeding up convergence when the number of features is large relative to the number of rows.
3.2.3 - 2026-03-18
Bug fix:
- Fixed incorrect call in
log_likelihood. The previous implementation always returned NaN.
3.2.2 - 2026-03-17
Bug fix:
- Fixed incorrect formula in
inverse_derivative2. This affected observed information matrix computation and robust/clustered standard errors for models using the complementary log-log link.
3.2.1 - 2026-03-16
Bug fix:
- Fixed an error when predicting at a specific
alphawith categorical features.
Other changes:
- Downgraded log messages in
align_df_categoriesandadd_missing_categoriesfrom INFO to DEBUG, and deduplicated them so they are emitted only once per column per fitted model.
3.2.0 - 2026-03-10
New features:
- Add
solver="closed-form"for Gaussian identity-link models, using an analytical normal-equations solution for ridge/OLS, auto-selecting it undersolver="auto"for unconstrained no-L1 cases, and falling back to least-squares for singular or ill-conditioned systems. GeneralizedLinearRegressorandGeneralizedLinearRegressorCVnow accept Polars DataFrames as input, in addition to pandas DataFrames and numpy arrays.
Bug fixes:
- Fixed
predict(X, alpha_index=...)andpredict(X, alpha=...)onGeneralizedLinearRegressorCV, which previously raised an error. The CV estimator now refits on the full data over the entire alpha path for the bestl1_ratio_. - Fixed alpha path computation in
GeneralizedLinearRegressorCV: the alpha grid is now computed from the properly standardized feature matrix and per-featureP1penalties (matching the base class), and accounts foroffsetwhen present.
3.1.3 - 2025-02-18
Bug fixes:
- Fixed
deviance_path_inGeneralizedLinearRegressorCVbeing scaled down by a factor ofn_foldsbecause test fold weights were not normalized to sum to 1. - Fixed
NegativeBinomialDistributionthetasetter rejectingnp.numbertypes, causingdist.theta = dist.thetato raise aTypeError.
Other changes:
- We disabled fast math to avoid invalid results (e.g., when dividing by zero).
- The default
alpha_maxfor the regularization path in the pure ridge case (l1_ratio=0) is now computed from the null model gradient, matching glmnet's behavior. Previously it was hardcoded to 10. - When
min_alpha_ratiois not set andn_samples < n_features, the default is now1e-2instead of1e-6, matching glmnet's convention.
3.1.2 - 2025-01-30
Other changes:
- Linux-aarch64 wheels are now uploaded to PyPI.
3.1.1 - 2025-01-13
Bug fixes:
- Fixed a bug where
_rowwise_gradient_hessianand_eta_mu_deviancewould call functions with wrong arguments in thep = 3case. - Fixed
glum.InverseGaussianDistributionnot using the optimized gradient, Hessian and deviance implementations, as well as those derivatives having the wrong sign.
Other changes:
- Build and test with Python 3.13 in CI.
3.1.0 - 2024-11-11
New features:
- New argument
max_inner_iterfor classesGeneralizedLinearRegressorandGeneralizedLinearRegressorCVto control the maximum number of iterations of the inner solver in the IRLS-CD algorithm. - New fitted attributes
col_means_andcol_stds_for classesGeneralizedLinearRegressorandGeneralizedLinearRegressorCV. GeneralizedLinearRegressornow prints more informative logs when fitting withalpha_search=Trueandverbose=True.
Bug fixes:
- Fixed a bug where
glum.GeneralizedLinearRegressor.fitwould raise adtypemismatch error if fit withalpha_search=True. - Use data type (
float64orfloat32) dependent precision in solvers.
Other changes:
- Lower absolute tolerance when matching the
alphaargument inglum.GeneralizedLinearRegressor.predictto thealphasused in training whenalpha_search=True.
3.0.2 - 2024-06-25
Bug fix:
- Fixed
wald_testwhen usingtermsand no intercept.
Other changes:
- Moved the development infrastructure to pixi.
- Moved the linting and formatting to ruff.
- Removed libblas MKL from the development environment.
- Replaced deprecated 'oldest-supported-numpy' dependency with 'numpy' to support 2.0 release.
3.0.1 - 2024-05-23
Bug fix:
- We now support scikit-learn 1.5.
3.0.0 - 2024-04-27
Breaking changes:
- All arguments to
GeneralizedLinearRegressorBase,GeneralizedLinearRegressorandGeneralizedLinearRegressorCVare now keyword-only. - All arguments to public methods of
GeneralizedLinearRegressorBase,GeneralizedLinearRegressororGeneralizedLinearRegressorCVexceptX,y,sample_weightandoffsetare now keyword-only. GeneralizedLinearRegressor's default value foralphais now0, i.e. no regularization.GammaDistribution,InverseGaussianDistribution,NormalDistributionandPoissonDistributionno longer inherit fromTweedieDistribution.- The power parameter of
TweedieLinkhas been renamed fromptopower, in line withTweedieDistribution. TweedieLinkno longer instantiatesIdentityLinkorLogLinkforpower=0andpower=1, respectively. On the other hand,TweedieLinkis now compatible withpower=0andpower=1.
New features:
- Added a formula interface for specifying models.
- Improved feature name handling. Feature names are now created for non-pandas input matrices too. Furthermore, the format of categorical features can be specified by the user.
- Term names are now stored in the model's attributes. This is useful for categorical features, where they refer to the whole variable, not just single levels.
- Added more options for treating missing values in categorical columns. They can either raise a
ValueError("fail"), be treated as all-zero indicators ("zero") or represented as a new category ("convert"). meth:GeneralizedLinearRegressor.wald_testcan now perform tests based on a formula string and term names.InverseGaussianDistributiongains alog_likelihoodmethod.
2.7.0 - 2024-02-19
Bug fix:
- Added cython compiler directive legacy_implicit_noexcept = True to fix performance regression with cython 3.
Other changes:
- Require Python>=3.9 in line with NEP 29.
- Build and test with Python 3.12 in CI.
- Added line search stopping criterion for tiny loss improvements based on gradient information.
- Added warnings about breaking changes in future versions.
2.6.0 - 2023-09-05
New features:
- Added the complementary log-log (
cloglog) link function. - Added the option to store the covariance matrix after estimating it. In this case, the covariance matrix does not have to be recomputed when calling inference methods.
- Added methods for performing Wald tests based on a restriction matrix, feature names or term names.
- Added a method for creating a coefficient table with confidence intervals and p-values.
Bug fix:
- Fixed
covariance_matrixmutating feature names when called with a data frame. See here.
Other changes:
- When computing the covariance matrix, check whether the design matrix is ill-conditioned for all types of input. Furthermore, do it in a more efficient way.
- Pin
tabmat<4.0.0(the new release will bring breaking changes).
2.5.2 - 2023-06-02
Bug fix
- Fix the
glm_benchmarks_analyzecommand line tool. See here. - Fixed a bug in
GeneralizedLinearRegressorwhen fit on a data set with a constant column andwarm_start=True. See here.
Other changes:
- Remove dev dependency on
dask_ml. - We now pin
llvm-openmp=11when creating the wheel for macOS in line with what scikit-learn does.
2.5.1 - 2023-05-19
Other changes:
- Better error message when the number of input features is different between the fit and predict methods.
Bug fix:
- We fixed a bug in the computation of
log_likelihood. Previously, this method just returnedNone.
2.5.0 - 2023-04-28
New feature:
- Added Negative Binomial distribution by setting the
'family'parameter ofGeneralizedLinearRegressorandGeneralizedLinearRegressorCVto'negative.binomial'.
2.4.1 - 2023-03-14
Bug fixes:
- Fixed an issue with
_score_matrixwhich failed when called with a tabmat matrix input.
Other changes:
- Removes unused scikit-learn cython imports.
2.4.0 - 2023-01-31
Other changes:
LogitLinkhas been made public.- Apple Silicon wheels are now uploaded to PyPI.
2.3.0 - 2023-01-06
Bug fixes:
- A data frame with dense and sparse columns was transformed to a dense matrix instead of a split matrix by
_set_up_and_check_fit_args. Fixed by callingtabmat.from_pandason any data frame.
New features:
- The following classes and functions have been made public:
BinomialDistribution,ExponentialDispersionModel,GammaDistribution,GeneralizedHyperbolicSecant,InverseGaussianDistribution,NormalDistribution,PoissonDistribution,IdentityLink,Link,LogLink,TweedieLink,get_familyandget_link. - The distribution and link classes now feature a more lenient equality check instead of the default identity check,
so that, e.g.,
TweedieDistribution(1) == TweedieDistribution(1)now returnsTrue.
2.2.1 - 2022-11-25
Other changes:
- Fixing pypi upload issue. Version 2.2.0 will not be available through the standard distribution channels.
2.2.0 - 2022-11-25
New features:
- Add an argument to GeneralizedLinearRegressorBase to drop the first category in a Categorical column using implementation in tabmat
- One may now request the Tweedie loss by setting the
'family'parameter ofGeneralizedLinearRegressorandGeneralizedLinearRegressorCVto'tweedie'.
Bug fixes:
- Setting bounds for constant columns was not working (bounds were internally modified to 0). A similar issue was preventing inequalities from working with constant columns. This is now fixed.
Other changes:
- No more builds for 32-bit systems with python >= 3.8. This is due to scipy not supporting it anymore.
2.1.2 - 2022-07-01
Other changes:
- Next attempt to build wheel for PyPI without
--march=native.
2.1.1 - 2022-07-01
Other changes:
- We are now building the wheel for PyPI without
--march=nativeto make it more portable across architectures.
2.1.0 - 2022-06-27
New features:
- Added
aic,aiccandbicattributes to theGeneralizedLinearRegressor. These attributes provide the information criteria based on the training data and the effective degrees of freedom of the maximum likelihood estimate for the model's parameters. std_errorsandcovariance_matrixofGeneralizedLinearRegressornow accept data frames with categorical data.
Bug fixes:
- The
scoremethod ofGeneralizedLinearRegressorandGeneralizedLinearRegressorCVnow accepts offsets. - Fixed the calculation of the information matrix for the Binomial distribution with logit link, which affected nonrobust standard errors.
Other:
- The CI now runs daily unit tests against the nightly builds of numpy, pandas and scikit-learn.
- The minimally required version of tabmat is now 3.1.0.
2.0.3 - 2021-11-05
Other:
- We are now specifying the run time dependencies in
setup.py, so that missing dependencies are automatically installed from PyPI when installingglumvia pip.
2.0.2 - 2021-11-03
Bug fix:
- Fixed the sign of the log likelihood of the Gaussian distribution (not used for fitting coefficients).
- Fixed the wide benchmarks which had duplicated columns (categorical and numerical).
Other:
- The CI now builds the wheels and upload to pypi with every new release.
- Renamed functions checking for qc.matrix compliance to refer to tabmat.
2.0.1 - 2021-10-11
Bug fix:
- Fixed pyproject.toml. We now support installing through pip and pep517.
2.0.0 - 2021-10-08
Breaking changes:
- Renamed the package to
glum!! Hurray! Celebration. GeneralizedLinearRegressorandGeneralizedLinearRegressorCVlose thefit_dispersionparameter. Please use thedispersionmethod of the appropriate family instance instead.- All functions now use
sample_weightas a keyword instead ofweights, in line with scikit-learn. - All functions now use
dispersionas a keyword instead ofphi. - Several methods
GeneralizedLinearRegressorandGeneralizedLinearRegressorCVthat should have been private have had an underscore prefixed on their names:tear_down_from_fit,_set_up_for_fit,_set_up_and_check_fit_args,_get_start_coef,_solveand_solve_regularization_path. glum.GeneralizedLinearRegressor.report_diagnosticsandglum.GeneralizedLinearRegressor.get_formatted_diagnosticsare now public.
New features:
- P1 and P2 now accepts 1d array with the same number of elements as the unexpanded design matrix. In this case, the penalty associated with a categorical feature will be expanded to as many elements as there are levels, all with the same value.
ExponentialDispersionModelgains adispersionmethod.BinomialDistributionandTweedieDistributiongain alog_likelihoodmethod.- The
fitmethod ofGeneralizedLinearRegressorandGeneralizedLinearRegressorCVnow saves the column types of pandas data frames. GeneralizedLinearRegressorandGeneralizedLinearRegressorCVgain two properties:family_instanceandlink_instance.std_errorsandcovariance_matrixhave been added and support non-robust, robust (HC-1), and clustered covariance matrices.GeneralizedLinearRegressorandGeneralizedLinearRegressorCVnow acceptfamily='gaussian'as an alternative tofamily='normal'.
Bug fix:
- The
scoremethod ofGeneralizedLinearRegressorandGeneralizedLinearRegressorCVnow accepts data frames. - Upgraded the code to use tabmat 3.0.0.
Other:
- A major overhaul of the documentation. Everything is better!
- The methods of the link classes will now return scalars when given scalar inputs. Under certain circumstances, they'd return zero-dimensional arrays.
- There is a new benchmark available
glm_benchmarks_runbased on the Boston housing dataset. See here. glm_benchmarks_analyzenow includesoffsetin the index. See here.glmnet_pythonwas removed from the benchmarks suite.- The innermost coordinate descent was optimized. This speeds up coordinate descent dominated problems like LASSO by about 1.5-2x. See here.
1.5.1 - 2021-07-22
Bug fix:
- Have the
linear_predictorandpredictmethods ofGeneralizedLinearRegressorandGeneralizedLinearRegressorCVhonor the offset whenalphaisNone.
1.5.0 - 2021-07-15
New features:
- The
linear_predictorandpredictmethods ofGeneralizedLinearRegressorandGeneralizedLinearRegressorCVgain analphaparameter (in complement toalpha_index). Moreover, they are now able to predict for multiple penalties.
Other:
- Methods of
Linknow consistently return NumPy arrays, whereas they used to preserve pandas series in special cases. - Don't list
sparse_dot_mklas a runtime requirement from the conda recipe. - The minimal
numpypin should be dependent on thenumpyversion inhostand not fixed to1.16.
1.4.3 - 2021-06-25
Bug fix:
copy_X = Falsewill now raise a value error whenXhas dtypeint32orint64. Previously, it would only raise for dtypeint64.
1.4.2 - 2021-06-15
Tutorials and documentation improvements:
- Adding tutorials to the documentation.
- Additional documentation improvements.
Bug fix:
- Verbose progress bar now working again.
Other:
- Small improvement in documentation for the
alpha_indexargument topredict. - Pinned pre-commit hooks versions.
1.4.1 - 2021-05-01
We now have Windows builds!
1.4.0 - 2021-04-13
Deprecations:
- Fusing the
alphaandalphasarguments forGeneralizedLinearRegressor.alphanow also accepts array like inputs.alphasis now deprecated but can still be used for backward compatibility. Thealphasargument will be removed with the next major version.
Bug fix:
- We removed entry points to functions in
glum_benchmarksfrom the conda package.
1.3.1 - 2021-04-12
Bug fix:
glum._distribution.unit_variance_derivativeis evaluating a proper numexpr expression again (regression in 1.3.0).
1.3.0 - 2021-04-12
New features:
- We added a new solver based on
scipy.optimize.minimize(method='trust-constr'). - We added support for linear inequality constraints of type
A_ineq.dot(coef_) <= b_ineq.
1.2.0 - 2021-02-04
We removed glum_benchmarks from the conda package.
1.1.1 - 2021-01-11
Maintenance release to get a fresh build for OSX.
1.1.0 - 2020-11-23
New feature:
- Direct support for pandas categorical types in
fitandpredict. These will be converted into aCategoricalMatrix.
1.0.1 - 2020-11-12
This is a maintenance release to be compatible with tabmat>=1.0.0.
1.0.0 - 2020-11-11
Other:
- Renamed
alpha_levelattribute ofGeneralizedLinearRegressorandGeneralizedLinearRegressorCVtoalpha_index. - Clarified behavior of
scale_predictors.
0.0.15 - 2020-11-11
Other:
- Pin
tabmat<1.0.0as we are expecting a breaking change with version 1.0.0.
0.0.14 - 2020-08-06
New features:
- Add Tweedie Link.
- Allow infinite bounds.
Bug fixes:
- Unstandardize regularization path.
- No copying in predict.
Other:
- Various memory and performance improvements.
- Update pre-commit hooks.
0.0.13 - 2020-07-23
See git history.
0.0.12 - 2020-07-07
See git history.
0.0.11 - 2020-07-02
See git history.
0.0.10 - 2020-06-30
See git history.
0.0.9 - 2020-06-26
See git history.
0.0.8 - 2020-06-24
See git history.
0.0.7 - 2020-06-17
See git history.
0.0.6 - 2020-06-16
See git history.
0.0.5 - 2020-06-10
See git history.
0.0.4 - 2020-06-08
See git history.
0.0.3 - 2020-06-08
See git history.