epicl 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- epicl-0.1.0/.gitignore +10 -0
- epicl-0.1.0/LICENSE +28 -0
- epicl-0.1.0/PKG-INFO +257 -0
- epicl-0.1.0/README.md +222 -0
- epicl-0.1.0/THIRD_PARTY_NOTICES.md +17 -0
- epicl-0.1.0/pyproject.toml +61 -0
- epicl-0.1.0/src/epicl/__init__.py +6 -0
- epicl-0.1.0/src/epicl/_sdm/LICENSE +204 -0
- epicl-0.1.0/src/epicl/_sdm/VENDORED.md +31 -0
- epicl-0.1.0/src/epicl/_sdm/__init__.py +53 -0
- epicl-0.1.0/src/epicl/_sdm/_constants.py +6 -0
- epicl-0.1.0/src/epicl/_sdm/_inference.py +42 -0
- epicl-0.1.0/src/epicl/_sdm/_kernels/__init__.py +11 -0
- epicl-0.1.0/src/epicl/_sdm/_kernels/rmsnorm_cast.py +93 -0
- epicl-0.1.0/src/epicl/_sdm/_kernels/segment_multi_reduce.py +142 -0
- epicl-0.1.0/src/epicl/_sdm/_kernels/triton/__init__.py +7 -0
- epicl-0.1.0/src/epicl/_sdm/_kernels/triton/rmsnorm_cast.py +136 -0
- epicl-0.1.0/src/epicl/_sdm/_kernels/triton/segment_multi_reduce.py +173 -0
- epicl-0.1.0/src/epicl/_sdm/_memory.py +34 -0
- epicl-0.1.0/src/epicl/_sdm/_warnings.py +29 -0
- epicl-0.1.0/src/epicl/_sdm/cache.py +164 -0
- epicl-0.1.0/src/epicl/_sdm/ensemble.py +502 -0
- epicl-0.1.0/src/epicl/_sdm/models/__init__.py +17 -0
- epicl-0.1.0/src/epicl/_sdm/models/_huggingface.py +49 -0
- epicl-0.1.0/src/epicl/_sdm/models/base.py +967 -0
- epicl-0.1.0/src/epicl/_sdm/models/callback.py +63 -0
- epicl-0.1.0/src/epicl/_sdm/models/ecoc.py +198 -0
- epicl-0.1.0/src/epicl/_sdm/models/kumo/__init__.py +13 -0
- epicl-0.1.0/src/epicl/_sdm/models/kumo/tabular/__init__.py +12 -0
- epicl-0.1.0/src/epicl/_sdm/models/kumo/tabular/block.py +101 -0
- epicl-0.1.0/src/epicl/_sdm/models/kumo/tabular/cell_embedding.py +86 -0
- epicl-0.1.0/src/epicl/_sdm/models/kumo/tabular/icl.py +134 -0
- epicl-0.1.0/src/epicl/_sdm/models/kumo/tabular/model.py +299 -0
- epicl-0.1.0/src/epicl/_sdm/models/kumo/tabular/recipe.py +72 -0
- epicl-0.1.0/src/epicl/_sdm/models/kumo/tabular/row_embedding.py +215 -0
- epicl-0.1.0/src/epicl/_sdm/models/tabfm/LICENSE +209 -0
- epicl-0.1.0/src/epicl/_sdm/models/tabfm/__init__.py +6 -0
- epicl-0.1.0/src/epicl/_sdm/models/tabfm/cell_embedding.py +220 -0
- epicl-0.1.0/src/epicl/_sdm/models/tabiclv2/LICENSE +33 -0
- epicl-0.1.0/src/epicl/_sdm/nn/__init__.py +29 -0
- epicl-0.1.0/src/epicl/_sdm/nn/_buffer.py +91 -0
- epicl-0.1.0/src/epicl/_sdm/nn/attention.py +816 -0
- epicl-0.1.0/src/epicl/_sdm/nn/glu.py +78 -0
- epicl-0.1.0/src/epicl/_sdm/nn/linear.py +46 -0
- epicl-0.1.0/src/epicl/_sdm/nn/rms_norm.py +60 -0
- epicl-0.1.0/src/epicl/_sdm/nn/rope.py +107 -0
- epicl-0.1.0/src/epicl/_sdm/nn/scaling.py +242 -0
- epicl-0.1.0/src/epicl/_sdm/nn/set_transformer.py +163 -0
- epicl-0.1.0/src/epicl/_sdm/nn/softplus.py +65 -0
- epicl-0.1.0/src/epicl/_sdm/processing/__init__.py +97 -0
- epicl-0.1.0/src/epicl/_sdm/processing/base.py +249 -0
- epicl-0.1.0/src/epicl/_sdm/processing/categorical/__init__.py +17 -0
- epicl-0.1.0/src/epicl/_sdm/processing/categorical/_categorical.py +61 -0
- epicl-0.1.0/src/epicl/_sdm/processing/categorical/align.py +541 -0
- epicl-0.1.0/src/epicl/_sdm/processing/categorical/count.py +122 -0
- epicl-0.1.0/src/epicl/_sdm/processing/categorical/impute.py +108 -0
- epicl-0.1.0/src/epicl/_sdm/processing/categorical/shuffle.py +205 -0
- epicl-0.1.0/src/epicl/_sdm/processing/common/__init__.py +33 -0
- epicl-0.1.0/src/epicl/_sdm/processing/common/callable.py +30 -0
- epicl-0.1.0/src/epicl/_sdm/processing/common/choice.py +186 -0
- epicl-0.1.0/src/epicl/_sdm/processing/common/drop.py +29 -0
- epicl-0.1.0/src/epicl/_sdm/processing/common/ensemble.py +188 -0
- epicl-0.1.0/src/epicl/_sdm/processing/common/identity.py +19 -0
- epicl-0.1.0/src/epicl/_sdm/processing/common/select.py +108 -0
- epicl-0.1.0/src/epicl/_sdm/processing/common/sequential.py +159 -0
- epicl-0.1.0/src/epicl/_sdm/processing/common/shuffle.py +196 -0
- epicl-0.1.0/src/epicl/_sdm/processing/common/stype.py +200 -0
- epicl-0.1.0/src/epicl/_sdm/processing/common/table.py +121 -0
- epicl-0.1.0/src/epicl/_sdm/processing/common/task.py +136 -0
- epicl-0.1.0/src/epicl/_sdm/processing/common/to_numerical.py +61 -0
- epicl-0.1.0/src/epicl/_sdm/processing/datetime/__init__.py +9 -0
- epicl-0.1.0/src/epicl/_sdm/processing/datetime/calendar.py +197 -0
- epicl-0.1.0/src/epicl/_sdm/processing/ensemble.py +204 -0
- epicl-0.1.0/src/epicl/_sdm/processing/execution.py +419 -0
- epicl-0.1.0/src/epicl/_sdm/processing/numerical/__init__.py +39 -0
- epicl-0.1.0/src/epicl/_sdm/processing/numerical/_stats.py +22 -0
- epicl-0.1.0/src/epicl/_sdm/processing/numerical/cast.py +31 -0
- epicl-0.1.0/src/epicl/_sdm/processing/numerical/clip.py +49 -0
- epicl-0.1.0/src/epicl/_sdm/processing/numerical/clip_soft.py +57 -0
- epicl-0.1.0/src/epicl/_sdm/processing/numerical/constant.py +236 -0
- epicl-0.1.0/src/epicl/_sdm/processing/numerical/flip_sign.py +79 -0
- epicl-0.1.0/src/epicl/_sdm/processing/numerical/impute.py +49 -0
- epicl-0.1.0/src/epicl/_sdm/processing/numerical/pca.py +63 -0
- epicl-0.1.0/src/epicl/_sdm/processing/numerical/power.py +326 -0
- epicl-0.1.0/src/epicl/_sdm/processing/numerical/quantile.py +306 -0
- epicl-0.1.0/src/epicl/_sdm/processing/numerical/quantile_clip.py +64 -0
- epicl-0.1.0/src/epicl/_sdm/processing/numerical/random_projection.py +87 -0
- epicl-0.1.0/src/epicl/_sdm/processing/numerical/rank_gaussian.py +169 -0
- epicl-0.1.0/src/epicl/_sdm/processing/numerical/robust_scale.py +89 -0
- epicl-0.1.0/src/epicl/_sdm/processing/numerical/sigma_clip.py +124 -0
- epicl-0.1.0/src/epicl/_sdm/processing/numerical/standardize.py +74 -0
- epicl-0.1.0/src/epicl/_sdm/processing/output/__init__.py +15 -0
- epicl-0.1.0/src/epicl/_sdm/processing/output/reduce.py +87 -0
- epicl-0.1.0/src/epicl/_sdm/processing/output/softmax.py +49 -0
- epicl-0.1.0/src/epicl/_sdm/processing/output/sort.py +17 -0
- epicl-0.1.0/src/epicl/_sdm/processing/recipe.py +155 -0
- epicl-0.1.0/src/epicl/_sdm/processing/text/__init__.py +13 -0
- epicl-0.1.0/src/epicl/_sdm/processing/text/sentence_transformer.py +452 -0
- epicl-0.1.0/src/epicl/_sdm/processing/text/tfidf.py +479 -0
- epicl-0.1.0/src/epicl/_sdm/relational/__init__.py +17 -0
- epicl-0.1.0/src/epicl/_sdm/relational/backend/__init__.py +13 -0
- epicl-0.1.0/src/epicl/_sdm/relational/backend/_cugraph.py +547 -0
- epicl-0.1.0/src/epicl/_sdm/relational/backend/_pyg_lib.py +176 -0
- epicl-0.1.0/src/epicl/_sdm/relational/data.py +393 -0
- epicl-0.1.0/src/epicl/_sdm/relational/join.py +174 -0
- epicl-0.1.0/src/epicl/_sdm/relational/sampler.py +260 -0
- epicl-0.1.0/src/epicl/_sdm/relational/task.py +466 -0
- epicl-0.1.0/src/epicl/_sdm/stype.py +396 -0
- epicl-0.1.0/src/epicl/_sdm/task.py +54 -0
- epicl-0.1.0/src/epicl/_sdm/tensor/__init__.py +21 -0
- epicl-0.1.0/src/epicl/_sdm/tensor/categorical.py +954 -0
- epicl-0.1.0/src/epicl/_sdm/tensor/columnar.py +1128 -0
- epicl-0.1.0/src/epicl/_sdm/tensor/io/__init__.py +23 -0
- epicl-0.1.0/src/epicl/_sdm/tensor/io/arrow.py +120 -0
- epicl-0.1.0/src/epicl/_sdm/tensor/io/cudf.py +47 -0
- epicl-0.1.0/src/epicl/_sdm/tensor/mixin.py +122 -0
- epicl-0.1.0/src/epicl/_sdm/tensor/nullable.py +964 -0
- epicl-0.1.0/src/epicl/_sdm/tensor/string.py +527 -0
- epicl-0.1.0/src/epicl/_sdm/tensor/table.py +2036 -0
- epicl-0.1.0/src/epicl/_sdm/tensor/var_len.py +1487 -0
- epicl-0.1.0/src/epicl/_sdm/testing/__init__.py +14 -0
- epicl-0.1.0/src/epicl/_sdm/testing/decorators.py +50 -0
- epicl-0.1.0/src/epicl/_sdm/testing/memory.py +93 -0
- epicl-0.1.0/src/epicl/_sdm/third_party/tabpfn-extensions/LICENSE +202 -0
- epicl-0.1.0/src/epicl/copula.py +217 -0
- epicl-0.1.0/src/epicl/encode.py +64 -0
- epicl-0.1.0/src/epicl/gp.py +240 -0
- epicl-0.1.0/src/epicl/law.py +217 -0
- epicl-0.1.0/src/epicl/model.py +220 -0
- epicl-0.1.0/src/epicl/regressor.py +537 -0
- epicl-0.1.0/src/epicl/views.py +43 -0
- epicl-0.1.0/src/epicl/weights.py +35 -0
- epicl-0.1.0/tests/test_api.py +372 -0
- epicl-0.1.0/tests/test_law.py +158 -0
epicl-0.1.0/.gitignore
ADDED
epicl-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, the EpICL authors
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
epicl-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: epicl
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: EpICL: tabular in-context regression with a joint predictive law and an epistemic / aleatoric split
|
|
5
|
+
Project-URL: Repository, https://github.com/ElSacho/EpICL
|
|
6
|
+
Project-URL: Weights, https://huggingface.co/PotoSacho/epicl
|
|
7
|
+
Author: Sacha Braun
|
|
8
|
+
License-Expression: BSD-3-Clause AND Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
License-File: THIRD_PARTY_NOTICES.md
|
|
11
|
+
License-File: src/epicl/_sdm/LICENSE
|
|
12
|
+
License-File: src/epicl/_sdm/models/tabfm/LICENSE
|
|
13
|
+
License-File: src/epicl/_sdm/models/tabiclv2/LICENSE
|
|
14
|
+
License-File: src/epicl/_sdm/third_party/tabpfn-extensions/LICENSE
|
|
15
|
+
Keywords: epistemic uncertainty,foundation model,in-context learning,regression,tabular data,uncertainty
|
|
16
|
+
Classifier: Intended Audience :: Science/Research
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Requires-Dist: huggingface-hub
|
|
24
|
+
Requires-Dist: numpy
|
|
25
|
+
Requires-Dist: pandas
|
|
26
|
+
Requires-Dist: pyarrow
|
|
27
|
+
Requires-Dist: safetensors
|
|
28
|
+
Requires-Dist: scikit-learn>=1.3
|
|
29
|
+
Requires-Dist: scipy
|
|
30
|
+
Requires-Dist: torch>=2.6
|
|
31
|
+
Requires-Dist: typing-extensions
|
|
32
|
+
Provides-Extra: test
|
|
33
|
+
Requires-Dist: pytest; extra == 'test'
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# EpICL
|
|
37
|
+
|
|
38
|
+
EpICL is a tabular foundation model for regression that predicts a **posterior over P(Y | X)**, the law of the label
|
|
39
|
+
given the features. From your training rows, it does not return one estimate of this law but a distribution over what
|
|
40
|
+
the law can be. It needs no training and no tuning: it reads your training rows and predicts the test rows in one
|
|
41
|
+
forward pass. The posterior gives what one law per row cannot:
|
|
42
|
+
|
|
43
|
+
- a **joint** predictive law over all the test rows, not one law per row: you can draw them together, and ask
|
|
44
|
+
questions about sums, averages, differences or whole curves;
|
|
45
|
+
- the split of each row's uncertainty into its **epistemic** part (what more data would remove) and its
|
|
46
|
+
**aleatoric** part (the noise that stays).
|
|
47
|
+
|
|
48
|
+
Paper: *EpICL: Epistemic Tabular Foundation Models for Full Bayesian Inference* (arXiv link: TODO).
|
|
49
|
+
Weights: [PotoSacho/epicl](https://huggingface.co/PotoSacho/epicl) on the Hugging Face Hub.
|
|
50
|
+
|
|
51
|
+
## Install
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install epicl
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Python 3.11 or later and PyTorch 2.6 or later. The weights of the model you pick are downloaded from the Hugging Face
|
|
58
|
+
Hub at the first `fit` (1 GB for a large model, 0.13 GB for a small one). A GPU is used when there is one.
|
|
59
|
+
|
|
60
|
+
## Quickstart
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
from epicl import EpICLRegressor
|
|
64
|
+
|
|
65
|
+
model = EpICLRegressor().fit(X_train, y_train) # no training: the rows are only stored
|
|
66
|
+
|
|
67
|
+
mean = model.predict(X_test) # E[y | x]
|
|
68
|
+
lo, hi = model.predict_interval(X_test, coverage=0.9) # where a new label will fall
|
|
69
|
+
f_lo, f_hi = model.predict_mean_interval(X_test, coverage=0.9) # where E[y | x] itself lies
|
|
70
|
+
sigma_e = model.predict_epistemic(X_test) # uncertainty on the function: shrinks with more rows
|
|
71
|
+
sigma_a = model.predict_aleatoric(X_test) # noise of the labels: stays
|
|
72
|
+
draws = model.sample_joint(X_test, n_samples=1000) # (1000, len(X_test)) joint draws of the labels
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
`X` is a NumPy array or a pandas DataFrame. Categorical columns (strings, categories, booleans) and missing values
|
|
76
|
+
(`NaN`, `None`) are handled as they are: no encoding and no imputation is needed.
|
|
77
|
+
|
|
78
|
+
## Models
|
|
79
|
+
|
|
80
|
+
Three classes, with the same parameters and methods:
|
|
81
|
+
|
|
82
|
+
| Class | Marginal law of each row | Dependence between rows and split |
|
|
83
|
+
|---|---|---|
|
|
84
|
+
| `EpICLRegressor` | EpICL's own | EpICL |
|
|
85
|
+
| `KumoEpiRegressor` | [Kumo-Tabular](https://huggingface.co/nvidia/Kumo-Tabular)'s | EpICL, through a copula |
|
|
86
|
+
| `EpiCopulaRegressor` | any other model's, unchanged | EpICL, through a copula |
|
|
87
|
+
|
|
88
|
+
`KumoEpiRegressor` (the paper's KumoL-Epi) gives the mean, quantiles and intervals of Kumo-Tabular, and adds the joint
|
|
89
|
+
law and the split to them. Use it when the accuracy of each row's prediction matters most, in particular with large
|
|
90
|
+
training sets. The trunk runs once: Kumo-Tabular's own last layers and quantile head read it next to EpICL's.
|
|
91
|
+
`shared_trunk=False` runs Kumo-Tabular whole a second time, with its own preprocessing of the table. It gives exactly
|
|
92
|
+
the predictions of the Kumo-Tabular package and takes about one and a half times as long.
|
|
93
|
+
|
|
94
|
+
`EpiCopulaRegressor(marginals=model)` does the same for any other model. The model only has to give quantiles: an
|
|
95
|
+
object with `predict_quantiles(X, alphas)`, or a function `f(X, alphas)`, returning an array of shape
|
|
96
|
+
`(len(X), len(alphas))`. `fit` also fits it when it has a `fit` method (pass `fit_marginals=False` for a model that is
|
|
97
|
+
already trained), and `n_quantiles` (999 by default) sets how many quantiles are asked. EpICL knows the rows given to
|
|
98
|
+
`fit` and nothing else: with a marginal model trained on many more rows, it overstates the epistemic part.
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
from epicl import EpiCopulaRegressor
|
|
102
|
+
|
|
103
|
+
model = EpiCopulaRegressor(marginals=my_model).fit(X_train, y_train) # my_model.predict_quantiles(X, alphas)
|
|
104
|
+
draws = model.sample_joint(X_test, n_samples=1000) # my_model's marginals, EpICL's dependence
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Each class comes in four variants:
|
|
108
|
+
|
|
109
|
+
| | `size="large"` (default) | `size="small"` |
|
|
110
|
+
|---|---|---|
|
|
111
|
+
| `latent=False` (default) | EpICL L, the paper's main model | EpICL S, lighter and faster |
|
|
112
|
+
| `latent=True` | EpICL-Lat L | EpICL-Lat S |
|
|
113
|
+
|
|
114
|
+
The latent models mix several processes, one per draw of a latent variable (`n_draws`, 32 by default), each weighted
|
|
115
|
+
by how well it explains the training rows. They take longer.
|
|
116
|
+
|
|
117
|
+
`n_estimators` ensembles the model as Kumo-Tabular does: each estimator sees the table through a different
|
|
118
|
+
preprocessing, and their predictive laws are averaged. The default is 16 for a large model and 8 for a small one.
|
|
119
|
+
`n_estimators=1` runs the raw table once and is the fastest; the paper reports 1 and 16.
|
|
120
|
+
|
|
121
|
+
## What you can ask
|
|
122
|
+
|
|
123
|
+
| Method | Returns |
|
|
124
|
+
|---|---|
|
|
125
|
+
| **Each row** | |
|
|
126
|
+
| `predict(X)` | the predictive mean |
|
|
127
|
+
| `predict_std(X)` | the total predictive standard deviation σ_t |
|
|
128
|
+
| `predict_quantiles(X, alphas)` | quantiles of the label, shape `(len(X), len(alphas))` |
|
|
129
|
+
| `predict_interval(X, coverage)` | the central interval `(lower, upper)` for a new label |
|
|
130
|
+
| **The split** | |
|
|
131
|
+
| `predict_epistemic(X)` | σ_e: the uncertainty on the function E[y \| x] |
|
|
132
|
+
| `predict_aleatoric(X)` | σ_a: the noise, with σ_e² + σ_a² = σ_t² |
|
|
133
|
+
| `predict_mean_quantiles(X, alphas)` | quantiles of the posterior of E[y \| x], shape `(len(X), len(alphas))` |
|
|
134
|
+
| `predict_mean_interval(X, coverage)` | the central credible interval `(lower, upper)` of E[y \| x] itself |
|
|
135
|
+
| **Several rows together** | |
|
|
136
|
+
| `sample_joint(X, n_samples)` | joint draws of the labels of all the rows; with `noise=False`, joint draws of the function E[y \| x] |
|
|
137
|
+
| `predict_cov(X)` | the covariance between the rows; with `noise=False`, the covariance of the function alone |
|
|
138
|
+
| `predict_copula(X)` | the t copula between the rows, in closed form: its correlation matrix and degrees of freedom, per estimator (not for the latent models) |
|
|
139
|
+
| **Scoring against labels** | |
|
|
140
|
+
| `predict_logpdf(X, y)` | the log-density of each label under its row's law |
|
|
141
|
+
| `predict_cdf(X, y)` | P(Y ≤ y) for each row (uniform when the model is calibrated) |
|
|
142
|
+
| `joint_logpdf(X, y)` | the log-density of all the labels at once, under the joint law |
|
|
143
|
+
|
|
144
|
+
The methods of the third group, and `joint_logpdf`, build a covariance between all the rows they are given, for every
|
|
145
|
+
estimator and latent draw (`n_estimators` × `n_draws` × rows² × 8 bytes): a few thousand rows for a plain model, about a
|
|
146
|
+
thousand for a latent one at the defaults (4 GB with a large latent model).
|
|
147
|
+
|
|
148
|
+
## Applications
|
|
149
|
+
|
|
150
|
+
Start with [Getting started](https://github.com/ElSacho/EpICL/blob/main/applications/00_getting_started.ipynb): a tour
|
|
151
|
+
of the three classes, of the latent models and of the main methods on one small problem.
|
|
152
|
+
|
|
153
|
+
The other notebooks of [`applications/`](https://github.com/ElSacho/EpICL/tree/main/applications) show what the joint
|
|
154
|
+
law and the split are for. Each one runs on a one-dimensional synthetic problem, so that everything can be plotted.
|
|
155
|
+
|
|
156
|
+
| Notebook | Question | Uses |
|
|
157
|
+
|---|---|---|
|
|
158
|
+
| [Batch active learning](https://github.com/ElSacho/EpICL/blob/main/applications/01_active_learning.ipynb) | Which rows should be labelled next? | `predict_cov`, `predict_aleatoric` |
|
|
159
|
+
| [Aggregates](https://github.com/ElSacho/EpICL/blob/main/applications/02_aggregates.ipynb) | How uncertain is the sum or the mean of many outcomes? | `sample_joint` |
|
|
160
|
+
| [Treatment effects](https://github.com/ElSacho/EpICL/blob/main/applications/03_treatment_effects.ipynb) | An interval for the average treatment effect, with an S-learner and a T-learner | `sample_joint(noise=False)` |
|
|
161
|
+
| [Bayes risk](https://github.com/ElSacho/EpICL/blob/main/applications/04_bayes_risk.ipynb) | How small can the error get on this table? | `predict_aleatoric`, `predict_epistemic` |
|
|
162
|
+
| [Out-of-distribution queries](https://github.com/ElSacho/EpICL/blob/main/applications/05_out_of_distribution.ipynb) | Is this query unlike the training rows? | `predict_epistemic` |
|
|
163
|
+
| [Functionals of P(Y \| x)](https://github.com/ElSacho/EpICL/blob/main/applications/06_functionals.ipynb) | A credible interval for E[y \| x] and for any quantity computed from it | `predict_mean_interval`, `sample_joint(noise=False)` |
|
|
164
|
+
| [Classification](https://github.com/ElSacho/EpICL/blob/main/applications/07_classification.ipynb) | How many positives in a group of rows? A joint law for class labels, from any classifier's probabilities | `sample_joint`, `predict_copula` |
|
|
165
|
+
|
|
166
|
+
## Parameters
|
|
167
|
+
|
|
168
|
+
| Parameter | Default | |
|
|
169
|
+
|---|---|---|
|
|
170
|
+
| `size` | `"large"` | the trunk, Kumo-Tabular L or S |
|
|
171
|
+
| `latent` | `False` | the latent model, a mixture over a latent variable |
|
|
172
|
+
| `n_estimators` | 16 (large), 8 (small) | the ensemble over preprocessed views of the table |
|
|
173
|
+
| `n_draws` | 32 | latent models: the draws of the latent variable |
|
|
174
|
+
| `rff` | `None` | random Fourier features, for large training sets (below) |
|
|
175
|
+
| `kv_cache` | `False` | run the training rows once, at `fit`: later predictions run the test rows only |
|
|
176
|
+
| `jitter` | the training one | added to every covariance the model factorises; keep the default |
|
|
177
|
+
| `device` | CUDA if available | |
|
|
178
|
+
| `weights` | the release | a local folder or a Hugging Face repository (or the environment variable `EPICL_WEIGHTS`) |
|
|
179
|
+
| `random_state` | 0 | seeds the estimators' views, the latent draws and `sample_joint` |
|
|
180
|
+
| `n_jobs` | `None` | CPU threads |
|
|
181
|
+
| `verbose` | `False` | print the progress |
|
|
182
|
+
| `query_batch_size` | 1024 | test rows per forward pass |
|
|
183
|
+
|
|
184
|
+
The parameters take effect at `fit`. `EpiCopulaRegressor` adds `marginals`, `fit_marginals` and `n_quantiles`.
|
|
185
|
+
`KumoEpiRegressor` adds `shared_trunk` (`True` by default): Kumo-Tabular's marginals are read off EpICL's pass of the
|
|
186
|
+
trunk, so the network runs once and `kv_cache` covers the marginals too. `False` runs Kumo-Tabular whole a second time.
|
|
187
|
+
|
|
188
|
+
## Large training sets
|
|
189
|
+
|
|
190
|
+
Conditioning on n training rows is exact by default: O(n³) time and O(n²) memory, fine up to about 10 000 rows, or
|
|
191
|
+
20 000 with 24 GB of GPU memory. Beyond, `rff` reads the kernel through that many random Fourier features, which makes
|
|
192
|
+
the memory linear in n:
|
|
193
|
+
|
|
194
|
+
```python
|
|
195
|
+
model = EpICLRegressor(rff=4096).fit(X_train, y_train)
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
The models were trained and evaluated with the exact kernel. Against it, on a synthetic table of 2 000 to 20 000
|
|
199
|
+
training rows, 4096 features move the mean by about 0.01 predictive standard deviations and keep σ_e within 1%; 1024
|
|
200
|
+
features move it by 0.02 and lower σ_e by up to 4%. The approximation biases the epistemic part downwards far from the
|
|
201
|
+
training rows, more so with fewer features.
|
|
202
|
+
|
|
203
|
+
## Missing values
|
|
204
|
+
|
|
205
|
+
A missing cell of `X` is left to the network, which treats it as Kumo-Tabular does: it reads the mean of the column
|
|
206
|
+
over the training rows, plus a learned missingness embedding. A query with a missing cell gets a wider law rather than
|
|
207
|
+
a wrong one. The labels `y` must be observed.
|
|
208
|
+
|
|
209
|
+
## How it works
|
|
210
|
+
|
|
211
|
+
EpICL keeps the trunk of Kumo-Tabular (NVIDIA) frozen and retrains a copy of its last two in-context layers to output
|
|
212
|
+
a Student-t process over the test rows, conditioned exactly on the training rows, in a space warped row by row so that
|
|
213
|
+
the marginals can be skewed or heavy-tailed. The process gives the dependence between rows, and the share of each
|
|
214
|
+
row's variance that belongs to the function gives σ_e and σ_a, by the law of total variance. The latent models add a
|
|
215
|
+
latent variable to the input of the retrained layers: fixed draws of it give as many processes, mixed by their evidence
|
|
216
|
+
on the training rows. `KumoEpiRegressor` keeps the ranks of EpICL's joint law (its copula) and reads each row's value
|
|
217
|
+
off Kumo-Tabular's own marginal, which Kumo-Tabular's last layers compute from the same pass of the trunk.
|
|
218
|
+
`EpiCopulaRegressor` does the same with the marginals of any other model.
|
|
219
|
+
|
|
220
|
+
## Reproducibility
|
|
221
|
+
|
|
222
|
+
- `random_state` (default 0) seeds everything random: the estimators' views of the table, the latent draws and
|
|
223
|
+
`sample_joint`. The same value gives the same predictions; 0 gives the paper's models.
|
|
224
|
+
- EpICL's views are drawn on the CPU, so `EpICLRegressor` predicts the same on CPU and GPU up to float rounding.
|
|
225
|
+
With `shared_trunk=False`, Kumo-Tabular draws its own estimators on the model's device, so the marginals of
|
|
226
|
+
`KumoEpiRegressor` then differ between CPU and GPU as they would between two values of `random_state`: by about
|
|
227
|
+
0.02 predictive standard deviations on the mean with 8 estimators.
|
|
228
|
+
- A row's law moves very slightly (about 1e-5 relative) with the other rows of its forward pass, because the training
|
|
229
|
+
jitter scales with the block's mean variance, as it did in training.
|
|
230
|
+
|
|
231
|
+
## Weights and licences
|
|
232
|
+
|
|
233
|
+
The code is under the BSD 3-Clause License. It includes a modified copy of NVIDIA's structured-data-models (Apache
|
|
234
|
+
License 2.0) in `src/epicl/_sdm/`: see `THIRD_PARTY_NOTICES.md`. The weights contain NVIDIA's Kumo-Tabular S and L
|
|
235
|
+
weights (OpenMDW License 1.1), stored unchanged next to EpICL's retrained parts, and are distributed under the same
|
|
236
|
+
licence. A local copy of the weight folder can be used with `EpICLRegressor(weights="path/to/folder")`.
|
|
237
|
+
|
|
238
|
+
## Development
|
|
239
|
+
|
|
240
|
+
The scripts read the research checkpoints and code from `EPICL_RESEARCH`, the research repository:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
EPICL_RESEARCH=/path/to/research_repo python scripts/export_weights.py --out release_weights # build the weight folder
|
|
244
|
+
EPICL_RESEARCH=/path/to/research_repo PYTHONPATH=src python scripts/check_against_research.py --weights release_weights
|
|
245
|
+
EPICL_WEIGHTS=release_weights pytest tests/
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Citation
|
|
249
|
+
|
|
250
|
+
```bibtex
|
|
251
|
+
@article{braun2026epicl,
|
|
252
|
+
title = {{EpICL}: Epistemic Tabular Foundation Models for Full {Bayesian} Inference},
|
|
253
|
+
author = {Braun, Sacha and Jordan, Michael I. and Bach, Francis and Holzm{\"u}ller, David},
|
|
254
|
+
journal = {arXiv preprint arXiv:TODO},
|
|
255
|
+
year = {2026}
|
|
256
|
+
}
|
|
257
|
+
```
|
epicl-0.1.0/README.md
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# EpICL
|
|
2
|
+
|
|
3
|
+
EpICL is a tabular foundation model for regression that predicts a **posterior over P(Y | X)**, the law of the label
|
|
4
|
+
given the features. From your training rows, it does not return one estimate of this law but a distribution over what
|
|
5
|
+
the law can be. It needs no training and no tuning: it reads your training rows and predicts the test rows in one
|
|
6
|
+
forward pass. The posterior gives what one law per row cannot:
|
|
7
|
+
|
|
8
|
+
- a **joint** predictive law over all the test rows, not one law per row: you can draw them together, and ask
|
|
9
|
+
questions about sums, averages, differences or whole curves;
|
|
10
|
+
- the split of each row's uncertainty into its **epistemic** part (what more data would remove) and its
|
|
11
|
+
**aleatoric** part (the noise that stays).
|
|
12
|
+
|
|
13
|
+
Paper: *EpICL: Epistemic Tabular Foundation Models for Full Bayesian Inference* (arXiv link: TODO).
|
|
14
|
+
Weights: [PotoSacho/epicl](https://huggingface.co/PotoSacho/epicl) on the Hugging Face Hub.
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install epicl
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Python 3.11 or later and PyTorch 2.6 or later. The weights of the model you pick are downloaded from the Hugging Face
|
|
23
|
+
Hub at the first `fit` (1 GB for a large model, 0.13 GB for a small one). A GPU is used when there is one.
|
|
24
|
+
|
|
25
|
+
## Quickstart
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
from epicl import EpICLRegressor
|
|
29
|
+
|
|
30
|
+
model = EpICLRegressor().fit(X_train, y_train) # no training: the rows are only stored
|
|
31
|
+
|
|
32
|
+
mean = model.predict(X_test) # E[y | x]
|
|
33
|
+
lo, hi = model.predict_interval(X_test, coverage=0.9) # where a new label will fall
|
|
34
|
+
f_lo, f_hi = model.predict_mean_interval(X_test, coverage=0.9) # where E[y | x] itself lies
|
|
35
|
+
sigma_e = model.predict_epistemic(X_test) # uncertainty on the function: shrinks with more rows
|
|
36
|
+
sigma_a = model.predict_aleatoric(X_test) # noise of the labels: stays
|
|
37
|
+
draws = model.sample_joint(X_test, n_samples=1000) # (1000, len(X_test)) joint draws of the labels
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`X` is a NumPy array or a pandas DataFrame. Categorical columns (strings, categories, booleans) and missing values
|
|
41
|
+
(`NaN`, `None`) are handled as they are: no encoding and no imputation is needed.
|
|
42
|
+
|
|
43
|
+
## Models
|
|
44
|
+
|
|
45
|
+
Three classes, with the same parameters and methods:
|
|
46
|
+
|
|
47
|
+
| Class | Marginal law of each row | Dependence between rows and split |
|
|
48
|
+
|---|---|---|
|
|
49
|
+
| `EpICLRegressor` | EpICL's own | EpICL |
|
|
50
|
+
| `KumoEpiRegressor` | [Kumo-Tabular](https://huggingface.co/nvidia/Kumo-Tabular)'s | EpICL, through a copula |
|
|
51
|
+
| `EpiCopulaRegressor` | any other model's, unchanged | EpICL, through a copula |
|
|
52
|
+
|
|
53
|
+
`KumoEpiRegressor` (the paper's KumoL-Epi) gives the mean, quantiles and intervals of Kumo-Tabular, and adds the joint
|
|
54
|
+
law and the split to them. Use it when the accuracy of each row's prediction matters most, in particular with large
|
|
55
|
+
training sets. The trunk runs once: Kumo-Tabular's own last layers and quantile head read it next to EpICL's.
|
|
56
|
+
`shared_trunk=False` runs Kumo-Tabular whole a second time, with its own preprocessing of the table. It gives exactly
|
|
57
|
+
the predictions of the Kumo-Tabular package and takes about one and a half times as long.
|
|
58
|
+
|
|
59
|
+
`EpiCopulaRegressor(marginals=model)` does the same for any other model. The model only has to give quantiles: an
|
|
60
|
+
object with `predict_quantiles(X, alphas)`, or a function `f(X, alphas)`, returning an array of shape
|
|
61
|
+
`(len(X), len(alphas))`. `fit` also fits it when it has a `fit` method (pass `fit_marginals=False` for a model that is
|
|
62
|
+
already trained), and `n_quantiles` (999 by default) sets how many quantiles are asked. EpICL knows the rows given to
|
|
63
|
+
`fit` and nothing else: with a marginal model trained on many more rows, it overstates the epistemic part.
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
from epicl import EpiCopulaRegressor
|
|
67
|
+
|
|
68
|
+
model = EpiCopulaRegressor(marginals=my_model).fit(X_train, y_train) # my_model.predict_quantiles(X, alphas)
|
|
69
|
+
draws = model.sample_joint(X_test, n_samples=1000) # my_model's marginals, EpICL's dependence
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Each class comes in four variants:
|
|
73
|
+
|
|
74
|
+
| | `size="large"` (default) | `size="small"` |
|
|
75
|
+
|---|---|---|
|
|
76
|
+
| `latent=False` (default) | EpICL L, the paper's main model | EpICL S, lighter and faster |
|
|
77
|
+
| `latent=True` | EpICL-Lat L | EpICL-Lat S |
|
|
78
|
+
|
|
79
|
+
The latent models mix several processes, one per draw of a latent variable (`n_draws`, 32 by default), each weighted
|
|
80
|
+
by how well it explains the training rows. They take longer.
|
|
81
|
+
|
|
82
|
+
`n_estimators` ensembles the model as Kumo-Tabular does: each estimator sees the table through a different
|
|
83
|
+
preprocessing, and their predictive laws are averaged. The default is 16 for a large model and 8 for a small one.
|
|
84
|
+
`n_estimators=1` runs the raw table once and is the fastest; the paper reports 1 and 16.
|
|
85
|
+
|
|
86
|
+
## What you can ask
|
|
87
|
+
|
|
88
|
+
| Method | Returns |
|
|
89
|
+
|---|---|
|
|
90
|
+
| **Each row** | |
|
|
91
|
+
| `predict(X)` | the predictive mean |
|
|
92
|
+
| `predict_std(X)` | the total predictive standard deviation σ_t |
|
|
93
|
+
| `predict_quantiles(X, alphas)` | quantiles of the label, shape `(len(X), len(alphas))` |
|
|
94
|
+
| `predict_interval(X, coverage)` | the central interval `(lower, upper)` for a new label |
|
|
95
|
+
| **The split** | |
|
|
96
|
+
| `predict_epistemic(X)` | σ_e: the uncertainty on the function E[y \| x] |
|
|
97
|
+
| `predict_aleatoric(X)` | σ_a: the noise, with σ_e² + σ_a² = σ_t² |
|
|
98
|
+
| `predict_mean_quantiles(X, alphas)` | quantiles of the posterior of E[y \| x], shape `(len(X), len(alphas))` |
|
|
99
|
+
| `predict_mean_interval(X, coverage)` | the central credible interval `(lower, upper)` of E[y \| x] itself |
|
|
100
|
+
| **Several rows together** | |
|
|
101
|
+
| `sample_joint(X, n_samples)` | joint draws of the labels of all the rows; with `noise=False`, joint draws of the function E[y \| x] |
|
|
102
|
+
| `predict_cov(X)` | the covariance between the rows; with `noise=False`, the covariance of the function alone |
|
|
103
|
+
| `predict_copula(X)` | the t copula between the rows, in closed form: its correlation matrix and degrees of freedom, per estimator (not for the latent models) |
|
|
104
|
+
| **Scoring against labels** | |
|
|
105
|
+
| `predict_logpdf(X, y)` | the log-density of each label under its row's law |
|
|
106
|
+
| `predict_cdf(X, y)` | P(Y ≤ y) for each row (uniform when the model is calibrated) |
|
|
107
|
+
| `joint_logpdf(X, y)` | the log-density of all the labels at once, under the joint law |
|
|
108
|
+
|
|
109
|
+
The methods of the third group, and `joint_logpdf`, build a covariance between all the rows they are given, for every
|
|
110
|
+
estimator and latent draw (`n_estimators` × `n_draws` × rows² × 8 bytes): a few thousand rows for a plain model, about a
|
|
111
|
+
thousand for a latent one at the defaults (4 GB with a large latent model).
|
|
112
|
+
|
|
113
|
+
## Applications
|
|
114
|
+
|
|
115
|
+
Start with [Getting started](https://github.com/ElSacho/EpICL/blob/main/applications/00_getting_started.ipynb): a tour
|
|
116
|
+
of the three classes, of the latent models and of the main methods on one small problem.
|
|
117
|
+
|
|
118
|
+
The other notebooks of [`applications/`](https://github.com/ElSacho/EpICL/tree/main/applications) show what the joint
|
|
119
|
+
law and the split are for. Each one runs on a one-dimensional synthetic problem, so that everything can be plotted.
|
|
120
|
+
|
|
121
|
+
| Notebook | Question | Uses |
|
|
122
|
+
|---|---|---|
|
|
123
|
+
| [Batch active learning](https://github.com/ElSacho/EpICL/blob/main/applications/01_active_learning.ipynb) | Which rows should be labelled next? | `predict_cov`, `predict_aleatoric` |
|
|
124
|
+
| [Aggregates](https://github.com/ElSacho/EpICL/blob/main/applications/02_aggregates.ipynb) | How uncertain is the sum or the mean of many outcomes? | `sample_joint` |
|
|
125
|
+
| [Treatment effects](https://github.com/ElSacho/EpICL/blob/main/applications/03_treatment_effects.ipynb) | An interval for the average treatment effect, with an S-learner and a T-learner | `sample_joint(noise=False)` |
|
|
126
|
+
| [Bayes risk](https://github.com/ElSacho/EpICL/blob/main/applications/04_bayes_risk.ipynb) | How small can the error get on this table? | `predict_aleatoric`, `predict_epistemic` |
|
|
127
|
+
| [Out-of-distribution queries](https://github.com/ElSacho/EpICL/blob/main/applications/05_out_of_distribution.ipynb) | Is this query unlike the training rows? | `predict_epistemic` |
|
|
128
|
+
| [Functionals of P(Y \| x)](https://github.com/ElSacho/EpICL/blob/main/applications/06_functionals.ipynb) | A credible interval for E[y \| x] and for any quantity computed from it | `predict_mean_interval`, `sample_joint(noise=False)` |
|
|
129
|
+
| [Classification](https://github.com/ElSacho/EpICL/blob/main/applications/07_classification.ipynb) | How many positives in a group of rows? A joint law for class labels, from any classifier's probabilities | `sample_joint`, `predict_copula` |
|
|
130
|
+
|
|
131
|
+
## Parameters
|
|
132
|
+
|
|
133
|
+
| Parameter | Default | |
|
|
134
|
+
|---|---|---|
|
|
135
|
+
| `size` | `"large"` | the trunk, Kumo-Tabular L or S |
|
|
136
|
+
| `latent` | `False` | the latent model, a mixture over a latent variable |
|
|
137
|
+
| `n_estimators` | 16 (large), 8 (small) | the ensemble over preprocessed views of the table |
|
|
138
|
+
| `n_draws` | 32 | latent models: the draws of the latent variable |
|
|
139
|
+
| `rff` | `None` | random Fourier features, for large training sets (below) |
|
|
140
|
+
| `kv_cache` | `False` | run the training rows once, at `fit`: later predictions run the test rows only |
|
|
141
|
+
| `jitter` | the training one | added to every covariance the model factorises; keep the default |
|
|
142
|
+
| `device` | CUDA if available | |
|
|
143
|
+
| `weights` | the release | a local folder or a Hugging Face repository (or the environment variable `EPICL_WEIGHTS`) |
|
|
144
|
+
| `random_state` | 0 | seeds the estimators' views, the latent draws and `sample_joint` |
|
|
145
|
+
| `n_jobs` | `None` | CPU threads |
|
|
146
|
+
| `verbose` | `False` | print the progress |
|
|
147
|
+
| `query_batch_size` | 1024 | test rows per forward pass |
|
|
148
|
+
|
|
149
|
+
The parameters take effect at `fit`. `EpiCopulaRegressor` adds `marginals`, `fit_marginals` and `n_quantiles`.
|
|
150
|
+
`KumoEpiRegressor` adds `shared_trunk` (`True` by default): Kumo-Tabular's marginals are read off EpICL's pass of the
|
|
151
|
+
trunk, so the network runs once and `kv_cache` covers the marginals too. `False` runs Kumo-Tabular whole a second time.
|
|
152
|
+
|
|
153
|
+
## Large training sets
|
|
154
|
+
|
|
155
|
+
Conditioning on n training rows is exact by default: O(n³) time and O(n²) memory, fine up to about 10 000 rows, or
|
|
156
|
+
20 000 with 24 GB of GPU memory. Beyond, `rff` reads the kernel through that many random Fourier features, which makes
|
|
157
|
+
the memory linear in n:
|
|
158
|
+
|
|
159
|
+
```python
|
|
160
|
+
model = EpICLRegressor(rff=4096).fit(X_train, y_train)
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
The models were trained and evaluated with the exact kernel. Against it, on a synthetic table of 2 000 to 20 000
|
|
164
|
+
training rows, 4096 features move the mean by about 0.01 predictive standard deviations and keep σ_e within 1%; 1024
|
|
165
|
+
features move it by 0.02 and lower σ_e by up to 4%. The approximation biases the epistemic part downwards far from the
|
|
166
|
+
training rows, more so with fewer features.
|
|
167
|
+
|
|
168
|
+
## Missing values
|
|
169
|
+
|
|
170
|
+
A missing cell of `X` is left to the network, which treats it as Kumo-Tabular does: it reads the mean of the column
|
|
171
|
+
over the training rows, plus a learned missingness embedding. A query with a missing cell gets a wider law rather than
|
|
172
|
+
a wrong one. The labels `y` must be observed.
|
|
173
|
+
|
|
174
|
+
## How it works
|
|
175
|
+
|
|
176
|
+
EpICL keeps the trunk of Kumo-Tabular (NVIDIA) frozen and retrains a copy of its last two in-context layers to output
|
|
177
|
+
a Student-t process over the test rows, conditioned exactly on the training rows, in a space warped row by row so that
|
|
178
|
+
the marginals can be skewed or heavy-tailed. The process gives the dependence between rows, and the share of each
|
|
179
|
+
row's variance that belongs to the function gives σ_e and σ_a, by the law of total variance. The latent models add a
|
|
180
|
+
latent variable to the input of the retrained layers: fixed draws of it give as many processes, mixed by their evidence
|
|
181
|
+
on the training rows. `KumoEpiRegressor` keeps the ranks of EpICL's joint law (its copula) and reads each row's value
|
|
182
|
+
off Kumo-Tabular's own marginal, which Kumo-Tabular's last layers compute from the same pass of the trunk.
|
|
183
|
+
`EpiCopulaRegressor` does the same with the marginals of any other model.
|
|
184
|
+
|
|
185
|
+
## Reproducibility
|
|
186
|
+
|
|
187
|
+
- `random_state` (default 0) seeds everything random: the estimators' views of the table, the latent draws and
|
|
188
|
+
`sample_joint`. The same value gives the same predictions; 0 gives the paper's models.
|
|
189
|
+
- EpICL's views are drawn on the CPU, so `EpICLRegressor` predicts the same on CPU and GPU up to float rounding.
|
|
190
|
+
With `shared_trunk=False`, Kumo-Tabular draws its own estimators on the model's device, so the marginals of
|
|
191
|
+
`KumoEpiRegressor` then differ between CPU and GPU as they would between two values of `random_state`: by about
|
|
192
|
+
0.02 predictive standard deviations on the mean with 8 estimators.
|
|
193
|
+
- A row's law moves very slightly (about 1e-5 relative) with the other rows of its forward pass, because the training
|
|
194
|
+
jitter scales with the block's mean variance, as it did in training.
|
|
195
|
+
|
|
196
|
+
## Weights and licences
|
|
197
|
+
|
|
198
|
+
The code is under the BSD 3-Clause License. It includes a modified copy of NVIDIA's structured-data-models (Apache
|
|
199
|
+
License 2.0) in `src/epicl/_sdm/`: see `THIRD_PARTY_NOTICES.md`. The weights contain NVIDIA's Kumo-Tabular S and L
|
|
200
|
+
weights (OpenMDW License 1.1), stored unchanged next to EpICL's retrained parts, and are distributed under the same
|
|
201
|
+
licence. A local copy of the weight folder can be used with `EpICLRegressor(weights="path/to/folder")`.
|
|
202
|
+
|
|
203
|
+
## Development
|
|
204
|
+
|
|
205
|
+
The scripts read the research checkpoints and code from `EPICL_RESEARCH`, the research repository:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
EPICL_RESEARCH=/path/to/research_repo python scripts/export_weights.py --out release_weights # build the weight folder
|
|
209
|
+
EPICL_RESEARCH=/path/to/research_repo PYTHONPATH=src python scripts/check_against_research.py --weights release_weights
|
|
210
|
+
EPICL_WEIGHTS=release_weights pytest tests/
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Citation
|
|
214
|
+
|
|
215
|
+
```bibtex
|
|
216
|
+
@article{braun2026epicl,
|
|
217
|
+
title = {{EpICL}: Epistemic Tabular Foundation Models for Full {Bayesian} Inference},
|
|
218
|
+
author = {Braun, Sacha and Jordan, Michael I. and Bach, Francis and Holzm{\"u}ller, David},
|
|
219
|
+
journal = {arXiv preprint arXiv:TODO},
|
|
220
|
+
year = {2026}
|
|
221
|
+
}
|
|
222
|
+
```
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
## Code
|
|
4
|
+
|
|
5
|
+
- **NVIDIA structured-data-models** (`src/epicl/_sdm/`): a modified copy, Apache License 2.0, Copyright (c) 2026
|
|
6
|
+
NVIDIA CORPORATION & AFFILIATES. Licence: `src/epicl/_sdm/LICENSE`. The modifications and the third-party code
|
|
7
|
+
inside it (TabICLv2, TabFM, TabPFN Extensions) are listed in `src/epicl/_sdm/VENDORED.md`.
|
|
8
|
+
- **TabICLv2** (https://github.com/soda-inria/tabicl), BSD 3-Clause, Copyright (c) 2025, Soda team @ Inria.
|
|
9
|
+
`src/epicl/gp.py` and `src/epicl/law.py` follow the deep-GP head code of the TabICL fork the model was developed in,
|
|
10
|
+
and `QuantileLaw` in `src/epicl/copula.py` follows its `QuantileDistribution` (exponential tails).
|
|
11
|
+
Licence: `src/epicl/_sdm/models/tabiclv2/LICENSE`.
|
|
12
|
+
|
|
13
|
+
## Weights
|
|
14
|
+
|
|
15
|
+
The weights are not part of this package. On first use they are downloaded from the Hugging Face Hub. They contain
|
|
16
|
+
NVIDIA's Kumo-Tabular S and L weights (https://huggingface.co/nvidia/Kumo-Tabular, revision v1.0.0), released under
|
|
17
|
+
the OpenMDW License 1.1, and are distributed under the same licence. See the model card of the weight repository.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.27"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "epicl"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "EpICL: tabular in-context regression with a joint predictive law and an epistemic / aleatoric split"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "BSD-3-Clause AND Apache-2.0"
|
|
11
|
+
license-files = [
|
|
12
|
+
"LICENSE",
|
|
13
|
+
"THIRD_PARTY_NOTICES.md",
|
|
14
|
+
"src/epicl/_sdm/LICENSE",
|
|
15
|
+
"src/epicl/_sdm/models/tabiclv2/LICENSE",
|
|
16
|
+
"src/epicl/_sdm/models/tabfm/LICENSE",
|
|
17
|
+
"src/epicl/_sdm/third_party/tabpfn-extensions/LICENSE",
|
|
18
|
+
]
|
|
19
|
+
authors = [{ name = "Sacha Braun" }]
|
|
20
|
+
requires-python = ">=3.11"
|
|
21
|
+
keywords = ["tabular data", "foundation model", "in-context learning", "uncertainty", "epistemic uncertainty",
|
|
22
|
+
"regression"]
|
|
23
|
+
classifiers = [
|
|
24
|
+
"Intended Audience :: Science/Research",
|
|
25
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
26
|
+
"Programming Language :: Python :: 3",
|
|
27
|
+
"Programming Language :: Python :: 3.11",
|
|
28
|
+
"Programming Language :: Python :: 3.12",
|
|
29
|
+
"Programming Language :: Python :: 3.13",
|
|
30
|
+
]
|
|
31
|
+
dependencies = [
|
|
32
|
+
"torch>=2.6",
|
|
33
|
+
"numpy",
|
|
34
|
+
"scipy",
|
|
35
|
+
"scikit-learn>=1.3",
|
|
36
|
+
"huggingface_hub",
|
|
37
|
+
"safetensors",
|
|
38
|
+
"pandas",
|
|
39
|
+
"pyarrow",
|
|
40
|
+
"typing_extensions",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
[project.optional-dependencies]
|
|
44
|
+
test = ["pytest"]
|
|
45
|
+
|
|
46
|
+
[project.urls]
|
|
47
|
+
Repository = "https://github.com/ElSacho/EpICL"
|
|
48
|
+
Weights = "https://huggingface.co/PotoSacho/epicl"
|
|
49
|
+
# TODO at release: Paper
|
|
50
|
+
|
|
51
|
+
[tool.hatch.version]
|
|
52
|
+
path = "src/epicl/__init__.py"
|
|
53
|
+
|
|
54
|
+
[tool.hatch.build.targets.wheel]
|
|
55
|
+
packages = ["src/epicl"]
|
|
56
|
+
|
|
57
|
+
[tool.hatch.build.targets.sdist]
|
|
58
|
+
include = ["/src", "/tests", "/README.md", "/LICENSE", "/THIRD_PARTY_NOTICES.md"]
|
|
59
|
+
|
|
60
|
+
[tool.pytest.ini_options]
|
|
61
|
+
pythonpath = ["src"]
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"""EpICL: tabular in-context regression with a joint predictive law and an epistemic / aleatoric split."""
|
|
2
|
+
|
|
3
|
+
from .regressor import EpICLRegressor, EpiCopulaRegressor, KumoEpiRegressor
|
|
4
|
+
|
|
5
|
+
__version__ = "0.1.0"
|
|
6
|
+
__all__ = ["EpICLRegressor", "EpiCopulaRegressor", "KumoEpiRegressor"]
|