Python implementation of surrogate-accelerated Markov chain Monte Carlo methods for postrior sampling in Bayesian inversion. Based on the delayed acceptance Metropolis-Hastings algorithm.
- numpy
- scipy
- mpi4py
- matplotlib
- torch (for neural network surrogate model)
- scikit-learn (for polynomial surrogate model)
- pandas (for post-processing)
- emcee (for post-processing)
What is given:
- forward model:
$G:\mathbb{R}^{n}\rightarrow\mathbb{R}^{m}$ - observations (noisy outputs of the forward model):
$y\in\mathbb{R}^{m}$ - prior probability density function (pdf):
$f_{U}$ - noise pdf:
$f_{Z}$
Input parameters
Additive noise is considered; therefore, the posterior pdf is given by the following formula:
- several Markov chains generated in parallel
- the chains share one surrogate model, which is refined during the sampling process using data from all chains
- the chains share a pool of spawned solvers (processes that evaluate
$G$ )- assumed to be the computationally most demanding part
- a solver is typically a linked numerical library
- number of solvers is typically lower than number of chains
- open repository in the Docker container (e.g. using the Dev Containers extension of Visual Studio Code)
pip install .
Before running the sampling process, it is necessary to specify:
- configuration (basic settings, e.g. number of solvers, initial samples, ...)
- prior
- likelihood
- solver specification
- surrogate model updater
- list of stages
See examples in the toy_examples folder, e.g.:
cd toy_examples/
mpiexec -n 4 python3 -m mpi4py minimal_example.py
The following non-intrusive surrogate models are implemented. They are constructed from snapshots
- polynomial chaos approximation - complete polynomials, adaptive increase of maximum degree based on available data (using scikit-learn)
- radial basis functions interpolation (RBF) - combined with polynomials up to chosen degree (using SciPy)
- approximation using nearest points identified using kd-tree (using SciPy)
- multilayer perceptron regressor (using PyTorch)