Skip to main content

Doubt

Bringing back uncertainty to machine learning.


PyPI Status Documentation License LastCommit Code Coverage Conference

A Python package to include prediction intervals in the predictions of machine learning models, to quantify their uncertainty.

Installation

You can install doubt with pip:

pip install doubt

If you want to be able to use the preprocessed regression datasets as well, you install it with the datasets extra:

pip install doubt[datasets]

Features

  • Bootstrap wrapper for all Scikit-Learn models
    • Can also be used to calculate usual bootstrapped statistics of a dataset
  • Quantile Regression for all generalised linear models
  • Quantile Regression Forests
  • A uniform dataset API, with 24 regression datasets and counting

Quick Start

If you already have a model in Scikit-Learn, then you can simply wrap it in a Boot to enable predicting with prediction intervals:

>>> from sklearn.linear_model import LinearRegression
>>> from doubt import Boot
>>> from doubt.datasets import PowerPlant
>>>
>>> X, y = PowerPlant().split()
>>> clf = Boot(LinearRegression())
>>> clf = clf.fit(X, y)
>>> clf.predict([10, 30, 1000, 50], uncertainty=0.05)
(481.9203102126274, array([473.43314309, 490.0313962 ]))

Alternatively, you can use one of the standalone models with uncertainty outputs. For instance, a QuantileRegressionForest:

>>> from doubt import QuantileRegressionForest as QRF
>>> from doubt.datasets import Concrete
>>> import numpy as np
>>>
>>> X, y = Concrete().split()
>>> clf = QRF(max_leaf_nodes=8)
>>> clf.fit(X, y)
>>> clf.predict(np.ones(8), uncertainty=0.25)
(16.933590347847982, array([ 8.93456428, 26.0664534 ]))

Citation

@inproceedings{mougannielsen2023monitoring,
  title={Monitoring Model Deterioration with Explainable Uncertainty Estimation via Non-parametric Bootstrap},
  author={Mougan, Carlos and Nielsen, Dan Saattrup},
  booktitle={AAAI Conference on Artificial Intelligence},
  year={2023}
}

Metadata

Release files for doubt 6.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for doubt 6.0.0
File Size Uploaded
doubt-6.0.0.tar.gz 39.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for doubt 6.0.0
File Interpreter ABI Platform
doubt-6.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 106.2 kB

Release files / doubt-6.0.0.tar.gz

Download URL doubt-6.0.0.tar.gz
Size 39.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c1a6217b3b6c198261f090a5db31dfe8c85a48b36dd33ca8ba95e478ee4cba20
BLAKE2b-256 checksum
How to use checksums
ab2b4d27d38e7efd46a6f5f591b99c49979ac517d7454f9e84cdaf5086ba17cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.12.2 Darwin/23.2.0

Release files / doubt-6.0.0-py3-none-any.whl

Download URL doubt-6.0.0-py3-none-any.whl
Size 66.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0adc0f4344dae4cab9fdf9585f5205b31a79a2543210fcdd2d8c8f427e9cfb09
BLAKE2b-256 checksum
How to use checksums
7482769c9524be70fcf99fbc3270b843a0516d3a33d452e0bf5e5cce4ef36532
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.12.2 Darwin/23.2.0

Release history Release notifications | RSS feed

This release

6.0.0 This release

2 release files

5.1.0

2 release files

5.0.0

2 release files

4.5.2

2 release files

4.5.1

2 release files

4.5.0

2 release files

4.4.1

2 release files

4.4.0

2 release files

4.3.1

2 release files

4.3.0

2 release files

4.2.0

2 release files

4.1.0

2 release files

4.0.0

2 release files

3.0.0

2 release files

2.3.0

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page