Skip to main content

Bayesian regression for low-noise data using POPS algorithm

Project description

POPSRegression

Try the online demo from Prof. James Kermode (U Warwick)

Linear regression scheme from the paper

Parameter uncertainties for imperfect surrogate models in the low-noise regime

TD Swinburne and D Perez, Machine Learning: Science and Technology 2025

@article{swinburne2025,
	author={Swinburne, Thomas and Perez, Danny},
	title={Parameter uncertainties for imperfect surrogate models in the low-noise regime},
	journal={Machine Learning: Science and Technology},
	doi={10.1088/2632-2153/ad9fce},
	year={2025}
}

Installation

There will be a PR on scikit-learn "soon", but in the meantime

pip install POPSRegression

What is POPSRegression?

Bayesian regression for low-noise data (vanishing aleatoric uncertainty).

Fits the weights of a regression model using BayesianRidge, then estimates weight uncertainties (sigma_ in BayesianRidge) accounting for model misspecification using the POPS (Pointwise Optimal Parameter Sets) algorithm [1]. The alpha_ attribute which estimates aleatoric uncertainty is not used for predictions as correctly it should be assumed negligable.

Bayesian regression is often used in computational science to fit the weights of a surrogate model which approximates some complex calculation. In many important cases the target calculation is near-deterministic, or low-noise, meaning the true data has vanishing aleatoric uncertainty. However, there can be large misspecification uncertainty, i.e. the model weights are instrinsically uncertain as the model is unable to exactly match training data.

Existing Bayesian regression schemes based on loss minimization can only estimate epistemic and aleatoric uncertainties. In the low-noise limit, weight uncertainties (sigma_ in BayesianRidge) are significantly underestimated as they only account for epistemic uncertainties which decay with increasing data. Predictions then assume any additional error is due to an aleatoric uncertainty (alpha_ in BayesianRidge), which is erroneous in a low-noise setting. This has significant implications on how uncertainty is propagated using weight uncertainties.

Example usage

Here, usage follows sklearn.linear_model, inheriting BayesianRidge

After running BayesianRidge.fit(..), the alpha_ attribute is not used for predictions.

The sigma_ matrix still contains epistemic weight uncertainties, whilst misspecification_sigma_ contains the POPS uncertainties.

from POPSRegression import POPSRegression

X_train,X_test,y_train,y_test = ...

# Sobol resampling of hypercube with 1.0 samples / training point
model = POPSRegression(resampling_method='sobol',resample_density=1.)

# fit the model, sample POPS hypercube
model.fit(X_train,y_train)

# Return mean and hypercube std
y_pred, y_std = model.predict(X_test,return_std=True)

# can also return max/min 
y_pred, y_std, y_max, y_min = model.predict(X_test,return_std=True,return_bounds=True)

# can also return the epistemic uncertainty seperately
y_pred, y_std, y_max, y_min, y_epistemic_std = model.predict(X_test,return_std=True,return_bounds=True,return_epistemic_std=True)

Toy example

Extreme low-dimensional case, fitting N data points to a quartic polynomial (P=5 parameters) to a complex oscillatory function. Green: two sigma of sigma_ weight uncertainty from Bayesian Regression (i.e. without alpha_ term for aleatoric error) Orange: two sigma of sigma_ and misspecification_sigma_ posterior from POPS Regression Gray: min-max of posterior from POPS Regression

As can be seen, the final error bars give very good coverage of the test output

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

popsregression-0.3.7.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

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

popsregression-0.3.7-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file popsregression-0.3.7.tar.gz.

File metadata

  • Download URL: popsregression-0.3.7.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for popsregression-0.3.7.tar.gz
Algorithm Hash digest
SHA256 ac771fcede04888eac72d1e554bf4ae927a7f43b56a62da3a567f12ce6ae8739
MD5 8b04d5b2ab1a4d52be19a83e63f5fab4
BLAKE2b-256 fc645c114a9e4b27651c0c6116ee7dec2f24f58085528f23fd5635f0d10281e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for popsregression-0.3.7.tar.gz:

Publisher: publish.yml on tomswinburne/POPS-Regression

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

File details

Details for the file popsregression-0.3.7-py3-none-any.whl.

File metadata

  • Download URL: popsregression-0.3.7-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for popsregression-0.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 3c11e18cb0fd99ce6afd84629c6ee51320443732d2719ec3efb200810fadd7ea
MD5 778fcdef06bb58bd2c9c913f466d97b2
BLAKE2b-256 defc11d8c176e961b2cf76c94ce44598885a06eafb149a191ee558203b01bc1b

See more details on using hashes here.

Provenance

The following attestation bundles were made for popsregression-0.3.7-py3-none-any.whl:

Publisher: publish.yml on tomswinburne/POPS-Regression

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