Skip to main content

Direct Epistemic Uncertainty Prediction (DEUP) for any scikit-learn model, 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.

PyPI CI Docs

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)

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 error predictor
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
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
Tutorials tabular · finance · conformal · active learning
When is agg-g reliable? reliability
Contributing CONTRIBUTING.md

Status

v0.3.1 — full stack: estimators, conformal calibration, reliability diagnostics, domain presets, benchmarks, tutorials (CI-tested).

Citing

Cite this software (CITATION.cff) and Lahlou et al. (2023).

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

deup-0.3.1.tar.gz (203.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deup-0.3.1-py3-none-any.whl (58.9 kB view details)

Uploaded Python 3

File details

Details for the file deup-0.3.1.tar.gz.

File metadata

  • Download URL: deup-0.3.1.tar.gz
  • Upload date:
  • Size: 203.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for deup-0.3.1.tar.gz
Algorithm Hash digest
SHA256 d7c4d174c2d4cee1c825bc623e6b2b150427a2efc462a5766a0aecb59215d352
MD5 5dbe6e5665a18d12f04ced28c25e077b
BLAKE2b-256 5476a92f436cf71d57108ee810a8c8f3418300f8e4c5e2a47e91ef70ba60e34a

See more details on using hashes here.

Provenance

The following attestation bundles were made for deup-0.3.1.tar.gz:

Publisher: release.yml on ursinasanderink/deup

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file deup-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: deup-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 58.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for deup-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 462ea73f5ea6fd019a14123859d4f9956c05e6e333161b208e4a84ce73903d28
MD5 6da446ba6fcad59916b91a407f6db226
BLAKE2b-256 df8ccd8212f94682c772f5a5fb8238d064c8cea9c63eb66b41e5b7fffa6d3a9c

See more details on using hashes here.

Provenance

The following attestation bundles were made for deup-0.3.1-py3-none-any.whl:

Publisher: release.yml on ursinasanderink/deup

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page