Skip to main content

Computational Uncertainty Quantification for Inverse problems in Python

Project description

CUQIpy logo

Computational Uncertainty Quantification for Inverse Problems in python

pytest docs

Computational Uncertainty Quantification for Inverse Problems in python (CUQIpy) is a python package for modeling and solving inverse problems in a Bayesian inference framework. CUQIpy provides a simple high-level interface to perform UQ analysis of inverse problems, while still allowing full control of the models and methods. The package comes equipped with a number of predefined distributions, samplers, models and test problems and is built to be easily further extended when needed.

You can find the full CUQIpy documentation here.

This software package is part of the CUQI project funded by the Villum Foundation.

Quickstart

Install CUQIpy using pip:

pip install cuqipy

For more detailed instructions, see the Getting Started guide.

Quick Example - UQ in 5 steps

Image deconvolution with uncertainty quantification

# Imports
import numpy as np
import matplotlib.pyplot as plt
from cuqi.testproblem import Deconvolution2D
from cuqi.data import grains
from cuqi.distribution import Laplace_diff, Gaussian
from cuqi.problem import BayesianProblem

# Step 1: Model and data, y = Ax
A, y_data, info = Deconvolution2D.get_components(dim=128, phantom=grains())

# Step 2: Prior, x ~ Laplace_diff(0, 0.01)
x = Laplace_diff(location=np.zeros(A.domain_dim),
                 scale=0.01,
                 bc_type='neumann',
                 physical_dim=2)

# Step 3: Likelihood, y ~ N(Ax, 0.0036^2)
y = Gaussian(mean=A@x, cov=0.0036**2)

# Step 4: Set up Bayesian problem and sample posterior
BP = BayesianProblem(y, x).set_data(y=y_data)
samples = BP.sample_posterior(200)

# Step 5: Analysis
info.exactSolution.plot(); plt.title("Exact solution")
y_data.plot(); plt.title("Data")
samples.plot_mean(); plt.title("Posterior mean")
samples.plot_std(); plt.title("Posterior standard deviation")

Exact solution Data Posterior mean Posterior standard deviation

Plugins

CUQIpy can be extended with additional functionality by installing optional plugins. These can be found at CUQI-DTU.

Contributing

We welcome contributions to CUQIpy. Please see our contributing guidelines for more information.

Contributors

See the list of contributors who participated in this project.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

CUQIpy-0.2.0.post0.dev113.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

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

CUQIpy-0.2.0.post0.dev113-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

Details for the file CUQIpy-0.2.0.post0.dev113.tar.gz.

File metadata

  • Download URL: CUQIpy-0.2.0.post0.dev113.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for CUQIpy-0.2.0.post0.dev113.tar.gz
Algorithm Hash digest
SHA256 10c7edaf32462c30021a9909ba1a8df4d515a91ef6cc85e97808eda70532fd4f
MD5 a50c46fe064821bd1bf8630c1f562a70
BLAKE2b-256 0174a6a335730b6c13397daa79321623a89c0ad8d001837e0c0625545188e087

See more details on using hashes here.

File details

Details for the file CUQIpy-0.2.0.post0.dev113-py3-none-any.whl.

File metadata

File hashes

Hashes for CUQIpy-0.2.0.post0.dev113-py3-none-any.whl
Algorithm Hash digest
SHA256 dc817ac86d5f716e74d9ac5344a5425e8b1d6d9929ab7de95463c01d57676b0a
MD5 4f1b7f20cb7aae216ffc561dd07a5122
BLAKE2b-256 90462a49548cda1e7a2d6d943245c42c29227e6899dda92da140cae25889f62a

See more details on using hashes here.

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