Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

1. Overview of CUQIpy

1.1. What is CUQIpy?

Computational Uncertainty Quantification for Inverse problems in Python (CUQIpy) is a Python package that provides a framework for solving inverse problems using Bayesian inference.

CUQIpy framework enables:

The following figure is a schematic overview of the CUQIpy framework, which shows the main components of the framework and how they are connected. The user supplies the forward model (or alternatively uses one of the predefined forward models in CUQIpy), the data, and the statistical assumptions about the various unknown parameters and the data. The user then uses CUQIpy to model and solve the Bayesian inverse problem and to analyze and visualize the solution.

CUQIpy overview

1.2. Why CUQIpy?

CUQIpy is built to address the need for:

1.3. CUQIpy modules

CUQIpy consists of many modules for modeling, solving, and analyzing Bayesian inverse problems. These modules mostly correspond to typical components and tools needed for modeling and solving Bayesian inverse problems. Each module contains classes and functions that are designed to perform specific tasks. For an overview of the modules available in CUQIpy refer to the CUQIpy API reference.

CUQIpy modules

1.4. CUQIpy plugins

In addition to the CUQIpy modules, CUQIpy also has plugins that extend the functionality of the framework. These plugins allow integration of third-party software and tools with CUQIpy. To see the full list of available CUQIpy plugins, visit the CUQIpy plugins section in CUQIpy documentation.

CUQIpy plugins

1.5. CUQIpy design principles

A number of design principles have guided the development of CUQIpy, including:

Here we show an example of the alignment of CUQIpy modeling code with the mathematical formulation of a Bayesian inverse problem. Consider the following statistical assumptions about the unknown parameters and the data, which we refer to as a Bayesian model:

dGamma(1,104)sGamma(1,104)xLMRF(0,d1)yGaussian(Ax,s1I)\begin{align*} d &\sim \text{Gamma}(1, 10^{-4})\\ s &\sim \text{Gamma}(1, 10^{-4})\\ x &\sim \text{LMRF}(\mathbf{0}, d^{-1})\\ y &\sim \text{Gaussian}(\mathbf{A}\mathbf{x}, s^{-1}\mathbf{I})\\ \end{align*}

where xx is the unknown parameter we are interested in characterizing and yy is the data. d1d^{-1} and ss are additional unknown parameters, we refer to as hyperparameters. Here, d1d^{-1} and s1s^{-1} represent the precision parameters, the inverse of the variance, of the Laplace Markov Random Field (LMRF) prior of xx and the Gaussian distribution used to define the data distribution of yy, respectively. A\mathbf{A} is the forward operator. The joint distribution of these random variables is given by

p(d,s,x,y)=p(d)p(s)p(xd)p(yx,s)\begin{align*} p(d,s,x,y) &= p(d)p(s)p(x|d)p(y|x,s) \end{align*}

The corresponding Bayesian model and joint distribution in CUQIpy takes the following form:

d = Gamma(1, 1e-4)
s = Gamma(1, 1e-4)
x = LMRF(0, lambda d: 1/d)
y = Gaussian(A@x, lambda s: 1/s)
joint = JointDistribution(d, s, x, y)