Skip to content
maxmbayPublic

About

Flexible JAX and Equinox tabular models

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

ashlar

PyPI Python versions Tests License: Apache 2.0

Ashlar is a Python library for regression and classification on tabular data, built on JAX. Its main models are scikit-learn estimators, and a regressor can predict a probability distribution for each row.

The model Ashlar adds is the dressed model, ashlar.dressed(), named for the dressed stone of ashlar masonry. It pools five networks with five label readers, gives the pool a density, and corrects it with one more network. A label reader predicts a row from the training rows' labels, which it reads at prediction time.

On the ScoringBench leaderboard, the dressed model is the first model behind the pretrained tabular foundation models. ScoringBench's maintainer ran it and listed it on November 19, 2026. In our own run it ranks first of 21 untuned models trained from scratch, by CRPS across 99 tables.

Open in Colab Try it in five minutes: fit the dressed model, plot its predicted distributions, and score them beside CatBoost.

pip install "ashlar-tabular[dataframes]"
import ashlar

model = ashlar.dressed().fit(X, y)

dist = model.predict_dist(X_new)                 # one distribution per row
dist.log_prob(y_new)                             # exact log density
dist.cdf(y_new)                                  # exact CDF
model.predict(X_new)                             # the mean
model.predict_quantiles(X_new, [0.1, 0.5, 0.9])  # (rows, 3)
model.sample(X_new, n=1000)                      # (1000, rows)

A target with at most 20 distinct values gets an exact probability for each value and no density.

What each part adds on ScoringBench

Each row is one Ashlar model, ranked alone among the same 20 untuned models.

Model Mean rank Lead CRPS ratio to the row above
One network 3.58 0.93
That network pooled with one label reader 1.62 3.05 0.903
Five cross-fitted pairs pooled 1.38 3.32 0.978
The dressed model 1.33 3.39 0.987

Lead is the distance to the next model, condensité in every row; above 3.15 it is significant at the 5% level (Nemenyi test). The label reader is the largest step: it lowers a network's CRPS, the error of its predicted distributions, by 9.7% on the geometric mean. The first two rows come from the same fits, and so do the last two, so each of those steps changes one part; between them the code moved from research code to the library. The guide has all 21 mean ranks.

The general estimator

Besides the dressed model, Ashlar has one general estimator, used like XGBoost or LightGBM:

from ashlar import ASRClassifier, ASRRegressor
from xgboost import XGBClassifier, XGBRegressor

model = XGBRegressor().fit(X, y)          # XGBoost
model = ASRRegressor().fit(X, y)          # Ashlar
model.predict(X_new)                      # (rows,)

model = XGBClassifier().fit(X, labels)    # XGBoost
model = ASRClassifier().fit(X, labels)    # Ashlar
model.predict_proba(X_new)                # (rows, classes), in classes_ order

Set task to a distribution head and every method reads one predicted distribution:

model = ASRRegressor(task="mixture").fit(X, y)

model.predict(X_new)                          # the mean
model.predict_quantiles(X_new, [0.1, 0.9])    # (rows, 2)
model.predict_exceedance(X_new, 60)           # P(y > 60) for each row
model.sample(X_new, n=1000)                   # (1000, rows)
model.log_prob(X_new, y_new)                  # log density of each observed value
model.predict_dist(X_new)                     # the distribution itself, a JAX pytree

model.calibrate(X_holdout, y_holdout)         # split-conformal, on rows the model did not train on
model.predict_interval(X_new, coverage=0.8)   # (rows, 2): holds 80% of new rows like the held-out ones

Where to start

Find your data or problem in the first column and start from the call beside it; model is a regressor fitted with a distribution head, and every name imports from ashlar (horizon_frame from ashlar.horizon).

Your data or problem Start with Guide
A few hundred to a few thousand training rows, one numeric target with exact labels, at most thousands of rows to predict, and a predicted distribution worth a slow fit ashlar.dressed().fit(X, y). Slow to fit and to predict; no test has more than 2,400 training rows. dressed
A distribution per row with more rows than that, to train on or to predict: a skewed target, several peaks, a cap, fixed amounts ASRRegressor(task="mixture").fit(X, y). It has trained on two million rows in 2 to 5 minutes on 12 cores at its default budget (benchmarks). heads
A number or a class per row, as from XGBoost or LightGBM ASRRegressor().fit(X, y) or ASRClassifier().fit(X, y); tabm_piecewise().fit(X, y) is a stronger, slower network tabular
Counts ASRRegressor(task="negative_binomial").fit(X, y) heads
Often exactly zero, otherwise a positive amount ASRRegressor(task="hurdle").fit(X, y) heads
Ordered classes ASROrdinalClassifier().fit(X, y) tabular
Labels not seen exactly: survival times, sold-out days, ranges, rounded values, totals over several rows ASRRegressor(task="mixture").fit(X, observed.censored(y, sold_out)), or a label from observed.survival, interval, rounded, or total observed
Several targets predicted jointly ASRRegressor(task="multivariate_gaussian").fit(X, Y), or task="chain" for targets of different kinds distributions
Many groups, such as stores or patients, with few rows for most ASRRegressor(task="gaussian", random_effects={"store": "intercept"}).fit(X, y) effects
Terms you can plot and read, one per column ASRRegressor(task="gaussian", backbone="additive").fit(X, y), then model.shape_functions(X) additive
Intervals with a coverage guarantee model.calibrate(X_holdout, y_holdout), then model.predict_interval(X_new, coverage=0.8) heads
A decision under a cost, such as how much to order model.predict_order(X_new, under=9, over=1) distributions
Many time series with covariates (work in progress) horizon_frame(sales, target="units", lookback=28, horizon=12, series="store", time="day"), then a joint head on frame.X and frame.Y forecast
Your own backbone or head ASRRegressor(backbone=Trunk).fit(X, y) with your Equinox class Trunk; task="custom" for a head models, showcase

docs/models.md has the fuller table of what the general estimator covers.

Properties

  • ASRRegressor and ASRClassifier drop in where XGBRegressor and LGBMClassifier are used, on pandas or Polars frames with string columns and missing values as they are (the calls that change).
  • Regressors with a distribution head and the dressed model are natively distributional: quantiles, intervals, tail probabilities, samples, and the mean are read from one predicted distribution per row, so they agree (docs/heads.md).
  • Every forward pass gives a log probability: log_prob is exact, with no sampling, for every distribution head, the classifiers, and the dressed model. The point regressor and the quantile head have none (docs/estimator.md).
  • Models are modular: a general model is five independent choices (column encoding, backbone, head, label type, training schedule), and the backbone and head can be your own Equinox modules (docs/models.md).
  • Ashlar is built on JAX: a GPU needs one extra install and no code changes, and jax.grad differentiates a fitted general model in its numeric inputs (docs/distributions.md).

How the dressed model works

ashlar.dressed() is for one numeric target with exact labels, when the predicted distribution is worth a slow fit: a median of 32 minutes per fold on ScoringBench, with six fits sharing a 12-core laptop CPU. It suits a few hundred to a few thousand training rows and at most thousands of rows to predict, because reading a row's full distribution takes tenths of a second on a laptop CPU.

The five steps of a dressed model, top to bottom: five networks and five label readers, a pool weight, smoothing, a corrector network, and a gate. The label readers are marked as the part this model adds.

Each of five pairs, a network and a label reader, is fitted on four fifths of the rows. The pool weight, the smoothing, the corrector, and a gate between the corrected and smoothed pools are then fitted on the rows the pairs held out.

The model adds the label reader and its pairing with a network. A reader solves a ridge regression of the training labels inside its forward pass, then spreads a row's probability over the leave-one-out residuals by attention. TabR and ModernNCA read training labels at prediction time too, and return one number; TabPFN reads them with pretrained weights. The rest builds on established work: the networks follow TabM, the smoothing is kernel dressing from weather forecasting, and the corrector and gate follow the PIT boosting of condensité, the next model in the table above.

No test has more than 2,400 training rows. A target that the columns determine almost exactly can come out worse than the five pairs pooled without dressing: 5.5 times their CRPS on one development fold. docs/dressed.md has every step and the tests, including the designs that failed.

What else is in the library

The five choices that define a model: encode, backbone, head, label, and train, with one combination highlighted.

Each tile opens an example in docs/showcase.md with its code, and docs/benchmarks.md has every result. docs/models.md has the full list.

Distribution heads
Distribution heads
Claims at four fixed amounts: 42% observed, 33% predicted, CatBoost 3%
Survival analysis
Survival analysis
Passes D-calibration on 4 of 5 splits; tuned XGBoost AFT on none
Partially observed labels
Partially observed labels
Days when four products all sell out (simulated): 11.4% predicted, 11.1% observed, 0.7% from separate models
Multivariate targets
Multivariate targets
Calibrated 80% intervals for hourly bike rentals: 80 riders wide, LightGBM with CQR 85
Random effects
Random effects
CRPS for stores with 1 to 5 days of data: 0.096, GPBoost 0.125
Additive models
Additive models
Same terms as R's gamlss; 10 seconds per fit on 12 cores, gamlss 4 to 6 minutes on one thread
Calibrated intervals and missing inputs
Calibrated intervals
Coverage between 75% and 85% in 21 of 24 hours; LightGBM with CQR in 10
Decisions and explanations
Decisions and explanations
Orders for any cost ratio from one model; LightGBM refitted per ratio costs up to 23% more
Forecasting (work in progress)
Forecasting (in progress)
CRPS of 12-day sales totals: 2,623, DeepAR 3,881

Documentation

docs/README.md is the index, and CHANGELOG.md lists each release.

License and acknowledgements

Ashlar is released under the Apache 2.0 license.

The tabm backbone and the tabm() and tabm_piecewise() recipes follow TabM, by Yury Gorishniy, Akim Kotelnikov, and Artem Babenko (paper, code). The piecewise-linear and periodic numeric embeddings follow Gorishniy, Rubachev, and Babenko (2022).

About

Flexible JAX and Equinox tabular models

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages