t-boost
A Tabulating Boosting Machine (TBM): gradient boosting whose fitted model is exactly a set of rating tables.
Documentation: https://pricingfrontier.github.io/t-boost/
Why
Gradient-boosted trees are usually more accurate than a GLM, but they are hard to read, review or deploy in systems built around rating tables. t-boost aims to get boosting-level accuracy in a model that is a set of main-effect and interaction tables, with no approximation and no surrogate model.
How it works
- Constrained trees. Each tree is symmetric (oblivious): every level applies one shared
(feature, threshold)split. Each tree may use only a few distinct features, so the whole ensemble has a fixed maximum interaction order (up to 8th order). - Exact decomposition. Because of that structure, the trained ensemble can be rewritten as a functional-ANOVA (fANOVA) decomposition: one table per main effect and per interaction. The tables reproduce the model's predictions exactly, to floating-point tolerance.
- Purification. The tables are centred on the training data (exposure-weighted when an exposure is given), so each main effect carries as much of the signal as it can.
- The tables are the model. A saved model is stored as its rating tables, so what you review is exactly what gets deployed.
It has a Rust core with Python bindings, takes polars DataFrames directly and is deterministic.
Keeping the tables readable
A default fit runs four steps that keep the rating tables few, small and smooth. Each one can be tuned or switched off.
TBoostRegressor(
objective="poisson",
interaction_gain_hurdle=2.0, # 1. interaction hurdle (0.0 = off)
interaction_gain_hurdle_mode="adaptive",
prune=True, # 2. pruning
prune_main_effects=False, # (True = main effects can be dropped too)
band_tolerance=0.75, # 3. banding (None = off)
band_deviance_cap=0.001,
graduate=None, # 4. graduation (False = off)
)
1. Interaction hurdle
While a tree grows, a split that brings in a new feature raises the tree's interaction order. That split must earn enough gain relative to the tree's first (main-effect) split, and must beat the best split on a feature the tree already uses. Otherwise the tree keeps refining features it already has. This is soft heredity: interactions are admitted only on real evidence.
In the default "adaptive" mode the hurdle starts at full strength and relaxes as main-effect gains
fade. Three-way admissions face a stricter bar than two-way ones. "fixed" applies the scalar as
given, and interaction_gain_hurdle=0.0 restores plain greedy splitting.
2. Pruning
After the fit, the interaction tables are ranked by their purified variance and added back in that order, subject to heredity: a k-way table enters only once all its (k-1)-way sub-tables are in. Each prefix is scored on the bags' out-of-bag rows. The deployed set is the smallest prefix that captures 99.5% of the available improvement over the main-effects-only model and is within 0.1% of the best out-of-bag deviance. Main effects are kept by default.
prune_main_effects=True puts the main effects on the path too. The path then starts from the
intercept-only model, so the 99.5% is measured from there. A main effect enters at its own rank, or
just before the first interaction that contains it, so a kept interaction always keeps its main
effects. A feature whose main effect is dropped, and which no kept interaction uses, no longer
affects predictions.
A fit without out-of-bag rows (for example n_bags=1) falls back to a K-fold cross-validated
vote (prune_n_folds), which judges main effects the same way when prune_main_effects=True. The
selection is recorded in pruning_report_. prune=False deploys the full, unpruned table bank
instead.
3. Banding
Each surviving interaction table is condensed into a small product grid of bands. Adjacent cells are merged where the model barely distinguishes them, cheapest merge first. Every table that contains a feature cuts it at the same nested places, so bands line up across tables. Missing values always keep their own band.
How coarse the bands get is set by the model's own noise. The prediction change from banding is
held within (band_tolerance × σ)², where σ is the spread between bags. It is also capped at
band_deviance_cap (0.1%) of the training deviance. Banding needs bagging to measure σ. Its
report is in pruning_report_["banding"], and band_tolerance=None turns it off.
4. Graduation
Finally, the tables are smoothed with Whittaker-Henderson graduation, the actuarial smoother for rating factors. Each table picks its own strength by generalized cross-validation, so a table whose roughness is real shape is left untouched. No rows are held out for it.
graduation_alpha fixes one strength for every table. graduation_high_order_alpha (off by
default) adds a light neighbour smoothing for factored 3-way and higher interactions. Details are in
graduation_report_. graduate=False ships the unsmoothed bank. Graduation is skipped for
monotone-constrained fits and is not supported for 3+ class models.
Install
uv add t-boost
To build from source you need a Rust toolchain; run uv sync.
Quickstart
import polars as pl
from t_boost import TBoostClassifier, TBoostRegressor
train = pl.read_parquet("policies.parquet")
# Claim frequency: Poisson with an exposure offset
freq = TBoostRegressor(objective="poisson").fit(
train.select(FEATURES + ["ClaimCount", "Exposure"]),
"ClaimCount", # target, by column name
exposure="Exposure",
)
rate = freq.predict(test)
# Classification: binary, or softmax for 3+ classes
clf = TBoostClassifier().fit(train.select(FEATURES + ["Lapsed"]), "Lapsed")
proba = clf.predict_proba(test)
Categorical columns are encoded automatically. At prediction time, columns are matched by name.
Rating tables and explanations
import json
tables = json.loads(freq.tables(train)) # the fANOVA rating tables
freq.predict_contributions(test.head(5)) # per-prediction breakdown by table
freq.feature_importances_ # share of variance per feature
freq.actual_vs_expected(train, "ClaimCount", exposure="Exposure") # A/E by factor level
For each prediction, base_value + sum(contributions) equals the raw (link-scale) score, so the
explanation is exact rather than estimated. The output format matches rustystats'
GLMModel.predict_contributions.
Saving and loading
with open("freq.tboost", "wb") as f:
f.write(freq.to_bytes())
with open("freq.tboost", "rb") as f:
loaded = TBoostRegressor.from_bytes(f.read())
to_json() / from_json() give a diffable format. A loaded model predicts identically to the
original.
Objectives
| Objective | Use | Link |
|---|---|---|
squared_error |
regression | identity |
logistic |
binary classification | logit |
| softmax (automatic for 3+ classes) | multiclass | softmax |
poisson |
claim frequency / counts | log |
gamma |
severity | log |
tweedie |
pure premium | log |
License
Apache-2.0
Metadata
Release files for t-boost 0.8.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| t_boost-0.8.1.tar.gz | 1.0 MB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| t_boost-0.8.1-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details |
| t_boost-0.8.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| t_boost-0.8.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| t_boost-0.8.1-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details |
| t_boost-0.8.1-cp310-abi3-macosx_10_12_x86_64.whl | CPython 3.10 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 15.6 MB
Release files / t_boost-0.8.1.tar.gz
| Download URL | t_boost-0.8.1.tar.gz |
|---|---|
| Size | 1.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6ce8ffb3aa7c3c9d0d6e91da7b364b8bcad5ee3673bc994920295734fe202695
|
|
BLAKE2b-256 checksum How to use checksums |
d5433882723b9084a8ef51f8ed5c20a65b778d7960c1ac0b5ddb476c6037094c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.
Transparency logRelease files / t_boost-0.8.1-cp310-abi3-win_amd64.whl
| Download URL | t_boost-0.8.1-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 3.0 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
e9dd32c402edebe5945675c336d6526f2eab59e1b89c3d26f5e5d26b4bb95737
|
|
BLAKE2b-256 checksum How to use checksums |
4b551805ca29c1fc7618025391614b2af2003856313ca2be2ca21fa263f77dc1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.
Transparency logRelease files / t_boost-0.8.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | t_boost-0.8.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 3.1 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
802316eaa36822e95ceb366a7627d1fd56458d09171a80cf6c68638ddec1b365
|
|
BLAKE2b-256 checksum How to use checksums |
5df3552563a1bbc58a7d09871d81d501be5a9efb36545e91f4dcdce137367789
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.
Transparency logRelease files / t_boost-0.8.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | t_boost-0.8.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
d8a79a459f2b8d8bf3fb19f911096c699a002e312f389c5df5044c8a1d1c1d31
|
|
BLAKE2b-256 checksum How to use checksums |
55b75f252d9abfc1fbd25ec37bf43ed8bdb4340bc75664e49447a1a0ecd99bcb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.
Transparency logRelease files / t_boost-0.8.1-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | t_boost-0.8.1-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.6 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
2bc73a61a1c99065a9e388aad75877756c7f4caf406f167d6e3f76f6a8c5c0cc
|
|
BLAKE2b-256 checksum How to use checksums |
d2f79b25a04266d2264839a3b4d572252b348d7ef0eb82f898279c2dfa37ab21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.
Transparency logRelease files / t_boost-0.8.1-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | t_boost-0.8.1-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 3.0 MB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
22801dc38f73d648e4139b753faf8e1641b6d0ffc86321f15b3a112f9d21a052
|
|
BLAKE2b-256 checksum How to use checksums |
2a6b793f92f887d543c26f160fd6b71b60d648dd34b6326a2245091060e5cf86
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.
Transparency log