Changelog
4.3.3 - unreleased
Other changes:
tabmat.CategoricalMatrixvalidates indices passed together withcategorieswith NumPy'sminandmaxinstead of Python's built-in functions, which makes construction faster for large inputs.
4.3.2 - 2026-11-20
Bug fix:
tabmat.StandardizedMatrix.sandwich,matvecandtranspose_matvecare now accurate for dense columns whose means are large relative to their standard deviations, in atabmat.DenseMatrixor in the dense part of atabmat.SplitMatrix(#414). They used to expand the products into uncentered terms that nearly cancel, which could lose all significant digits. The kernels that read dense data now subtract the column means as they go, including the kernels for the products of the dense part with the sparse and categorical parts, so this costs no copy of the data. For a dense matrix the sandwich product also becomes 1.2-2x faster; the other products keep about their speed.tabmat.StandardizedMatrix.astypeno longer drops the scaling factors (mult) of the matrix.tabmat.DenseMatrix.transpose_matvecandtabmat.StandardizedMatrix.transpose_matvecnow return the columns in the order ofcolsifcolslists all columns in a different order. They used to return them in their original order.tabmat.CategoricalMatrix.matvec,transpose_matvecandsandwichnow accept vectors that are read-only or in non-native byte order (#565). They used to raise Cython buffer errors.transpose_matvecalso returned wrong results for non-contiguous vectors, such asvec[::2]; it now copies them to a contiguous array first.- The matrix products of
tabmat.DenseMatrix,tabmat.SparseMatrix,tabmat.SplitMatrixandtabmat.StandardizedMatrixnow accept read-only vectors and vectors in non-native byte order as well, like those ofCategoricalMatrix.sandwichreturned wrong results for a non-contiguousd(e.g.d[::2]) andSplitMatrix.transpose_matvecfor a non-contiguous vector; they now copy it first.tabmat.SparseMatrix(and matrices that contain one) no longer raise fortranspose_matvecandsandwichwhen built from read-only arrays, such as the arrays of a pandas DataFrame with copy-on-write. A non-contiguousoutraises an error instead of giving wrong results.
Other changes:
- The dense matrix-vector kernels used for row or column restrictions are vectorized along the direction that is not restricted, which makes most restricted products on dense data faster, by up to 2x.
- The C++ kernels are now plain C++17 templates: template parameters and
if constexprreplace the variants that used to be generated with Mako, somakois no longer a build dependency and no source files are generated at build time. The generated code is unchanged in structure and the test suite is untouched. tabmat.StandardizedMatrix.sandwichforms one outer product for the terms from the shift, added in place, instead of fourn_cols x n_colstemporaries, which makes it faster for wide matrices.tabmat.StandardizedMatrix.transpose_matvecno longer copies the vector and the shift and scaling factors with fancy indexing whenrowsorcolsisNone, which makes it about 1.25x faster for atabmat.SplitMatrix.- The sandwich product of the categorical and the sparse parts of a
tabmat.SplitMatrixuses a dedicated parallel kernel instead of scipy sparse matrix products, which makes it about 3-30x faster, depending on the shapes. - The documentation is now built with Zensical and mkdocstrings instead of Sphinx. The changelog and the docstrings are now written in Markdown. The documentation build treats warnings as errors and runs in CI.
4.3.1 - 2026-11-05
Bug fix:
- Fixed
tabmat.CategoricalMatrix.multiplyfor matrices with a single row, which failed becausenp.squeezereduced the multiplier to a 0-d array. tabmat.CategoricalMatrix.unpackno longer emits aDeprecationWarningcaused by internally accessing the deprecatedcatproperty.- Slicing a
tabmat.DenseMatrixno longer emits a spurious warning about non-contiguous input.
Other changes:
- 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
py315test environment and a conda package build for Python 3.15, and added the Python 3.14 and 3.15 classifiers. - Removed the
py310test environment and moved theoldiesenvironment and the conda package builds from Python 3.10 to 3.11. Theoldiespins for pandas (1.5.3), scipy (1.9.3) and setuptools (65) were raised to the oldest releases with Python 3.11 builds. - Raised ruff's target version to Python 3.11 and modernized type annotations.
4.3.0 - 2026-10-30
New feature:
- Numerical factors now record formulaic's
spans_interceptin the model spec'sencoder_state. For example, this shows whetherbs()dropped its first basis function.
Bug fixes:
- Fixed compatibility with polars 2.0, which removed
Series.cat.get_categories().
Other changes:
- Clarified that
sparse_thresholdis used to sparsify numerical columns and is not used to densify columns that are already sparse. - Fixed the benchmark harness silently recording zero timings and memory under pandas 3, where the chained assignment it used is rejected by copy-on-write.
from_dfnow builds its sparse block directly from pandas sparse columns instead of densifying them first, which makes construction much faster and uses memory proportional to the number of stored values rather than to the full block. Sparse columns whose fill value is not 0 are now stored as dense with a warning, sinceSparseMatrixonly represents a fill value of 0.- We disabled fast math to avoid invalid results (e.g., when dividing by zero).
4.2.1 - 2026-02-04
Bug fixes:
- Fixed methods
_cross_categorical,_cross_sandwich,multiply,tocsrofCategoricalMatrixand function_sandwich_cat_cat_limited_rows_colsto operate on read-only buffers as well.
4.2.0 - 2026-01-13
New feature:
tabmat.from_formulanow also supports any dataframe supported by narwhals.
Other changes:
- Require Python>=3.10.
4.1.5 - 2025-12-17
Other changes:
- Restore building wheels for Intel-based macOS systems.
4.1.4 - 2025-12-16
Other changes:
tabmat.from_dfnow avoids unnecessary copies of dense arrays, but still ensures that the results are contiguous (C or F order).- We now use
narwhals' v2 API for data frame handling.
4.1.3 - 2025-11-12
Bug fixes:
- Fixed
CategoricalMatrix.transpose_matvecto operate on read-only buffers as well. - Fixed incorrect calculation of the shape of a
CategoricalMatrixwhen initialized with zero categories anddrop_first=True.
4.1.2 - 2025-07-17
Bug fixes:
- Fixed a bug which caused issues when constructing tabmat matrices from existing
ModelSpec\s when they contained categorical columns with all levels dropped. - We can now treat dedicated pandas string series - which are the defaults for strings since pandas 2.3 - as categoricals.
4.1.1 - 2025-01-30
Bug fix:
- A more robust
DenseMatrix._get_col_stdsresults in more accurateStandardizedMatrix.sandwichresults.
Other changes:
- Build wheel for pypi on python 3.13.
- Build and test with python 3.13 in CI.
4.1.0 - 2024-11-07
New feature:
- Added a new function,
tabmat.from_df, to convert any dataframe supported by narwhals into atabmat.SplitMatrix.
Other changes:
- Allow
CategoricalMatrixto be initialized directly with indices and categories. - Added checks for dimension and
dtypemismatch inMatrixBasesandwich.sandwich.
Bug fix:
- Fixed a bug in
tabmat.CategoricalMatrix.standardizethat sometimes returnednanvalues for the standard deviation due to numerical instability if usingnp.float32precision.
4.0.1 - 2024-06-25
Other changes:
- Removed reference to the
.Aattribute and replaced it with.toarray(). - Add support between formulaic and pandas 3.0.
- Support pypi release for numpy 2.0
4.0.0 - 2024-04-23
Breaking changes:
- To unify the API,
DenseMatrixdoes not inherit fromnp.ndarrayanymore. To convert aDenseMatrixto anp.ndarray, useDenseMatrix.unpack. - Similarly,
SparseMatrixdoes not inherit fromsps.csc_matrixanymore. To convert aSparseMatrixto asps.csc_matrix, useSparseMatrix.unpack.
New features:
- Added column name and term name metadata to
MatrixBaseobjects. These are automatically populated when initializing aMatrixBasefrom apandas.DataFrame. In addition, they can be accessed and modified via theMatrixBase.column_namesandMatrixBase.term_namesproperties. - Added a formula interface for creating tabmat matrices from pandas data frames. See
tabmat.from_formulafor details. - Added support for missing values in
CategoricalMatrixby either creating a separate category for them or treating them as all-zero rows. - Added support for handling missing categorical values in pandas data frames.
Bug fix:
- Added cython compiler directive
legacy_implicit_noexcept = Trueto fix performance regression with cython 3.
Other changes:
- Refactored the pre-commit hooks to use ruff.
- Refactored
CategoricalMatrix.transpose_matvecto be deterministic when using OpenMP. - Adjusted transformation to sparse format in
tabmat.from_pandasto future changes in pandas.
3.1.13 - 2023-10-17
Other changes:
- Pypi release is now done using trusted publisher.
- Fix build and upload of
x86_64wheels on Linux.
3.1.12 - 2023-10-16
Other changes:
- Fixed macos arm64 wheels with proper linkage.
3.1.11 - 2023-10-13
Other changes:
- Improve the performance of
from_pandasin the case of low-cardinality categorical variables. - Require Python>=3.9 in line with NEP 29
- Build and test with Python 3.12 in CI.
- Fixed macos arm64 wheels with proper linkage.
3.1.10 - 2023-06-23
Bug fixes:
- We fixed a bug in the dense sandwich product, which would previously segfault for very large matrices.
- Fixed the column order when initializing a
SplitMatrixfrom a list containing otherSplitMatrixobjects. - Fixed
getcolnot respecting thedrop_firstattribute of aCategoricalMatrix.
3.1.9 - 2023-06-16
Other changes:
- Support building on architectures that are unsupported by xsimd.
3.1.8 - 2023-06-13
Other changes:
- The C++ types have been refactored. Loop indices are now using the
Py_ssize_ttype. Integers now have a templated type as well. - The documentation for
matvecandmatvec_transposehas been updated to reflect actual behavior. - Checks for dimension mismatch in
matvecandmatvec_transposearguments have been added. - Remove upper pin on xsimd.
3.1.7 - 2022-03-28
Bug fix:
- We fixed a bug in the cross sandwich product, which would previously segfault for very large matrices.
3.1.6 - 2022-03-27
Bug fix:
- We fixed a bug in the dense sandwich product, which would previously segfault for very large F-contiguous matrices.
3.1.5 - 2022-03-20
Bug fix:
- We fixed a bug in the dense matrix-vector and sandwich products, which would previously segfault for very large matrices.
3.1.4 - 2022-02-07
Bug fix:
- Fixed the loading of jemalloc in Apple Silicon wheels.
3.1.3 - 2022-01-26
Other changes:
- Build and upload wheels for Apple Silicon.
3.1.2 - 2022-07-01
Other changes:
- Next attempt to build wheel for PyPI without
march=native.
3.1.1 - 2022-07-01
Other changes:
- Add Python 3.10 support to CI (remove Python 3.6).
- Build wheel for PyPI without
march=native.
3.1.0 - 2022-03-07
New feature
tabmat.CategoricalMatrixnow accepts adrop_firstargurment. This allows the user to drop the first column of a CategoricalMatrix to avoid multicollinearity problems in unregularized models.tabmat.StandardizedMatrixandtabmat.MatrixBasenow support themultiplymethod.
3.0.8 - 2022-01-03
Bug fix
- Always use 64bit integers for indexing in
tabmat.ext.sparse.sparse_sandwichto avoid segmentation faults on very wide problems.
3.0.7 - 2021-11-23
Bug fix
- Disable the use of static TLS in the Linux wheels to avoid issues with too small TLS on some distributions.
3.0.6 - 2021-11-11
Bug fix
- We fixed a bug in
tabmat.SplitMatrix.matvec, where incorrect matrix vector products were computed when aSplitMatrixdid not contain any dense components.
3.0.5 - 2021-11-05
Other changes
- We are now specifying the run time dependencies in
setup.py, so that missing dependencies are automatically installed from PyPI when installingtabmatvia pip.
3.0.4 - 2021-11-03
Other changes
- tabmat is now available on PyPI and will be automatically updated when a new release is published.
3.0.3 - 2021-10-15
Bug fix
- We now support
xsimd>=8and support alternative jemalloc installations.
3.0.2 - 2021-10-14
Bug fix
- Allow to link to alternatively suffixed jemalloc installation to work around #113 .
3.0.1 - 2021-10-07
Bug fix
- The license was mistakenly left as proprietary. Corrected to BSD-3-Clause.
Other changes
- ReadTheDocs integration.
- CONTRIBUTING.md
- Correct pyproject.toml to work with PEP-517
3.0.0 - 2021-10-07
Breaking changes:
- The package has been renamed to
tabmat. CELEBRATE! - The
one_over_var_inf_to_valfunction has been made private. - The
csc_to_splitfunction has been re-named totabmat.from_cscto match thetabmat.from_pandasfunction. - The
tabmat.MatrixBase.get_col_meansandtabmat.MatrixBase.get_col_stdsmethods have been made private. - The
cross_sandwichmethod has also been made private.
Bug fix
StandardizedMatrix.transpose_matvecwas giving the wrong answer when theoutparameter was provided. This is now fixed.SplitMatrix.__repr__now calls the__repr__method of component matrices instead of__str__.
Other changes
- Optimized the
tabmat.SparseMatrix.matvecandtabmat.SparseMatrix.transpose_matvecfor whenrowsandcolsare None. - Implemented
CategoricalMatrix.__rmul__ - Reorganizing the documentation and updating the text to match the current API.
- Enable indexing the rows of a
CategoricalMatrix. PreviouslyCategoricalMatrix.__getitem__only supported column indexing. - Allow creating a
SplitMatrixfrom a list of anyMatrixBaseobjects including anotherSplitMatrix. - Reduced memory usage in
tabmat.SplitMatrix.matvec.
2.0.3 - 2021-07-15
Bug fix
- In
SplitMatrix.sandwich, when a col subset was specified, incorrect output was produced if the components of the indices array were not sorted.SplitMatrix.__init__now checks for sorted indices and maintains sorted index lists when combining matrices.
Other changes
SplitMatrix.__init__now filters out any empty matrices.StandardizedMatrix.sandwichpassesrows=Noneandcols=Noneonwards to the underlying matrix instead of replacing them with full arrays of indices. This should improve performance slightly.SplitMatrix.__repr__now includes the type of the underlying matrix objects in the string output.
2.0.2 - 2021-06-24
Bug fix
Sparse matrices now accept 64-bit indices on Windows.
2.0.1 - 2021-06-20
Bug fix:
Split matrices now also work on Windows.
2.0.0 - 2021-06-17
Breaking changes:
We renamed several public functions to make them private. These include functions in tabmat.benchmark that are unlikely to be used outside of this package as well as
tabmat.dense_matrix._matvec_helpertabmat.sparse_matrix._matvec_helper.tabmat.split_matrix._prepare_out_array.
Other changes:
- We removed the dependency on
sparse_dot_mkl. We now usescipy.sparse.csr_matvecinstead ofsparse_dot_mkl.dot_product_mklon all platforms, because the former suffered from poor performance, especially on narrow problems. This also means that we removed the functiontabmat.sparse_matrix._dot_product_maybe_mkl. - We updated the pre-commit hooks and made sure the code is line with the new hooks.
1.0.6 - 2020-04-26
Other changes:
We are now also making releases for Windows.
1.0.5 - 2020-04-26
Other changes:
Still trying.
1.0.4 - 2020-04-26
Other changes:
We are trying to make releases for Windows.
1.0.3 - 2020-04-21
Bug fixes:
- Added a check that matrices are two-dimensional in the
SplitMatrix.__init__ - Replace
np.intwithnp.int64where appropriate due to NumPy deprecation ofnp.int.
1.0.2 - 2020-04-20
Other changes:
- Added Python 3.9 support.
- Use
scipy.sparsedot product when MKL isn't available.
1.0.1 - 2020-11-25
Bug fixes:
- Handling for nulls when setting up a
CategoricalMatrix - Fixes to make several functions work with both row and col restrictions and out
Other changes:
- Added various tests and documentation improvements
1.0.0 - 2020-11-11
Breaking change:
- Rename
dottomatvec. Ourdotfunction supports matrix-vector multiplication for every subclass, but only supports matrix-matrix multiplication for some. We therefore rename it tomatvecin line with other libraries.
Bug fix:
- Fix a bug in
matvecfor categorical components when the number of categories exceeds the number of rows.
0.0.6 - 2020-08-03
See git history.