Efficient matrix representations for working with tabular data.
Actively maintained. Last release 10 days ago, commits in 13 of the last 26 weeks. A safe choice.
pip install tabmatEfficient matrix representations for working with tabular data
Installation
Simply install via conda-forge!
conda install -c conda-forge tabmat
Getting Started
The easiest way to start with tabmat is to use the convenience constructor tabmat.from_pandas.
import tabmat as tm
import numpy as np
dense_array = np.random.normal(size=(100, 1))
Use case
TL;DR: We provide matrix classes for efficiently building statistical algorithms with data that is partially dense, partially sparse and partially categorical.
Data used in economics, actuarial science, and many other fields is often tabular, containing rows and columns. Further common properties are also common:
- It often is very sparse.
- It often contains a mix of dense and sparse columns.
- It often contains categorical data, processed into many columns of indicator values created by "one-hot encoding."
High-performance statistical applications often require fast computation of certain operations, such as
- Computing sandwich products of the data,
transpose(X) @ diag(d) @ X. A sandwich product shows up in the solution to weighted least squares, as well as in the Hessian of the likelihood in generalized linear models such as Poisson regression. - Matrix-vector products, possibly on only a subset of the rows or columns. For example, when limiting computation to an "active set" in a L1-penalized coordinate descent implementation, we may only need to compute a matrix-vector product on a small subset of the columns.
