Direct Epistemic Uncertainty Prediction (DEUP) for scikit-learn and gradient-boosting models, with first-class time-series support.
Project description
deup
Direct Epistemic Uncertainty Prediction (DEUP) for any scikit-learn model — with first-class, leakage-correct time-series support.
DEUP estimates epistemic uncertainty by training a secondary error predictor on your model's out-of-sample errors — no ensembles, no Bayesian retraining, works with the model you already use.
Method credit: DEUP is due to Lahlou et al., 2023 (TMLR). This package is a maintained, benchmarked, scikit-learn-compatible implementation with time-series / cross-sectional finance support and aggregation-reliability diagnostics.
Repository: https://github.com/ursinasanderink/deup · Docs: https://ursinasanderink.github.io/deup/
Quickstart
from sklearn.ensemble import RandomForestRegressor
from deup import DEUPRegressor
model = DEUPRegressor(base_model=RandomForestRegressor())
model.fit(X_train, y_train)
pred, unc = model.predict(X_test, return_uncertainty=True)
Tabular gradient boosting (LightGBM / XGBoost / CatBoost):
from deup.domains.tabular import TabularDEUP
model = TabularDEUP(backend="lgbm", cv=5).fit(X_train, y_train)
unc = model.predict_epistemic(X_test)
Time-series / cross-sectional finance (flagship preset):
from deup.domains.finance import CrossSectionalDEUP
model = CrossSectionalDEUP(horizon=20).fit(panel_df)
pred, unc = model.predict(test_df, return_uncertainty=True)
health = model.health_report(test_df)
Install
pip install deup # core (numpy + scikit-learn)
pip install "deup[gbm]" # + LightGBM (TabularDEUP backend)
pip install "deup[xgb]" # + XGBoost
pip install "deup[catboost]" # + CatBoost
pip install "deup[gbm-all]" # all gradient-boosting backends
pip install "deup[finance]" # + pandas (CrossSectionalDEUP)
pip install "deup[docs]" # + MkDocs site locally
Why this package?
The only public DEUP code was a stale research repo of notebooks — no maintained
pip-installable package. Major UQ libraries (torch-uncertainty, uncertainty-toolbox,
MAPIE) don't implement DEUP. deup fills that gap with leakage-correct OOF error
construction and walk-forward / purged CV for time-series and finance.
Comparison (California housing, Spearman ρ vs realized squared error)
| Method | ρ | Notes |
|---|---|---|
| DEUP | 0.509 | OOF error predictor (RF base) |
| DEUP + LightGBM | 0.444 | TabularDEUP(backend="lgbm") |
| DEUP + XGBoost | 0.400 | TabularDEUP(backend="xgb") |
| DEUP + CatBoost | 0.407 | TabularDEUP(backend="catboost") |
| Ensemble disagreement | 0.460 | Bootstrap variance |
| Conformal residual | 0.447 | |y − ŷ| on cal split |
| Laplace (last-layer) | 0.015 | Not applicable to trees |
Full results: Benchmarks.
Documentation
| Topic | Link |
|---|---|
| Getting started | docs/getting-started |
| Five-axis guide | docs/concepts |
| Domain presets | docs/domains |
| Tutorials | tabular · finance · conformal · active learning |
| When is agg-g reliable? | reliability |
| PyTorch / TorchUncertainty | pytorch-integration |
| Contributing | CONTRIBUTING.md |
Status
v0.4.0 — complete library: core DEUP, conformal calibration, reliability diagnostics, domain presets (tabular GBM backends, finance, vision), benchmarks, tutorials, TorchUncertainty integration.
Citing
Cite this software (CITATION.cff), Lahlou et al. (2023) for the
DEUP method, and Sanderink (2026) for cross-sectional ranking and aggregation-
reliability extensions:
Sanderink, U. (2026) 'When Alpha Breaks: Two-Level Uncertainty for Safe Deployment of Cross-Sectional Stock Rankers', arXiv preprint arXiv:2603.13252. Available at: https://arxiv.org/pdf/2603.13252 (Accessed: 4 June 2026).
License
Apache-2.0. See LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file deup-0.4.2.tar.gz.
File metadata
- Download URL: deup-0.4.2.tar.gz
- Upload date:
- Size: 210.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7fa5dd33e65921cb6f89760707847618aa8d0b27738051bc1094f11cb0b34341
|
|
| MD5 |
743df0b306dd9fe0b3b0f5df6254e599
|
|
| BLAKE2b-256 |
4b9707b2790908f0d64fb6dd238f75ae9c3528ed2f93d60ef81d826053714b7a
|
Provenance
The following attestation bundles were made for deup-0.4.2.tar.gz:
Publisher:
release.yml on ursinasanderink/deup
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deup-0.4.2.tar.gz -
Subject digest:
7fa5dd33e65921cb6f89760707847618aa8d0b27738051bc1094f11cb0b34341 - Sigstore transparency entry: 1729146366
- Sigstore integration time:
-
Permalink:
ursinasanderink/deup@dec56a287db7141176da6d26e638e1aa0c741bb5 -
Branch / Tag:
refs/tags/v0.4.2 - Owner: https://github.com/ursinasanderink
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@dec56a287db7141176da6d26e638e1aa0c741bb5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file deup-0.4.2-py3-none-any.whl.
File metadata
- Download URL: deup-0.4.2-py3-none-any.whl
- Upload date:
- Size: 60.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0be1a10ec0c725305334fa157a980b90bf379f7c30c3044c585fdfa983d0363a
|
|
| MD5 |
6edf7d22c870f3d4a3257beef8b04b0c
|
|
| BLAKE2b-256 |
fbc1905b1d801447e0946882f60198ca704b00206ce5d96b86002e5dfc513be1
|
Provenance
The following attestation bundles were made for deup-0.4.2-py3-none-any.whl:
Publisher:
release.yml on ursinasanderink/deup
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deup-0.4.2-py3-none-any.whl -
Subject digest:
0be1a10ec0c725305334fa157a980b90bf379f7c30c3044c585fdfa983d0363a - Sigstore transparency entry: 1729146464
- Sigstore integration time:
-
Permalink:
ursinasanderink/deup@dec56a287db7141176da6d26e638e1aa0c741bb5 -
Branch / Tag:
refs/tags/v0.4.2 - Owner: https://github.com/ursinasanderink
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@dec56a287db7141176da6d26e638e1aa0c741bb5 -
Trigger Event:
push
-
Statement type: