aurelio-raffa / MultiFidelityABC

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MultiFidelityABC

Purpose

This project was created for the 2020 edition of the Bayesian Statistics Course for Mathematical Engineering (Politecnico di Milano).

The goal was to implement and test an Adaptive Multi-Fidelity algorithm for Monte Carlo Markov Chain (MCMC) simulations on Bayesian Inverse Problems, as proposed by Liang Yan and Tao Zhou in the Journal of Computational Physics (volume 381, 15 March 2019, pages 110-128, also available here).


Environment Setup

We use Anaconda to manage our execution environments. Once you have Anaconda installed,

  • if your operative system is OSX (64-bit), please open a terminal folder at the /requirements/ directory of this repository and run
    conda create --name myenv --file requirements_osx-64.txt

unfortunately as of today it is not possible to install the fenics package on Windows OS, so please in this case install Windows Subsystem for Linux (WSL) and then refer to the procedure found on the website of the FEniCS Project.


Examples

We have implemented two test cases:

  • /source/examples/poisson_multifidelity.py (inspired by this FEniCS tutorial), where we were able to obtain the following results
    true model (MH):
        wall time: .................................. 335.03s
        (avg.) time per iteration: .................. 0.0067s
        effective sample size (min.): ............... 2928 / 50000
        true model eval.: ........................... 50001
    ────────────────────────────────────────────────────────────
    PCE surr. (adap. MH):
        wall time: .................................. 85.62s
        (avg.) time per iteration: .................. 0.0017s
        effective sample size (min.): ............... 2953 / 50000
        true model eval.: ........................... 126
        fitting time: ............................... 0.1264s
        true mod. eval. during fitting: ............. 9
    ────────────────────────────────────────────────────────────
    GPR surr. (adap. MH):
        wall time: .................................. 29.94s
        (avg.) time per iteration: .................. 0.0006s
        effective sample size (min.): ............... 3042 / 50000
        true model eval.: ........................... 113
        fitting time: ............................... 0.1576s
        true mod. eval. during fitting: ............. 20
    
    namely a speedup of a factor 3.9 for the surrogate proposed in the paper versus a speedup factor of more than 11 with our own gaussian process surrogate;
  • /source/examples/hyperelastic_multifidelity.py (inspired by the example in this paper), where we obtained
    true model (MH):
        wall time: .................................. 21818.11s
        (avg.) time per iteration: .................. 1.4545s
        effective sample size (min.): ............... 590 / 15000
        true model eval.: ........................... 60004
    ────────────────────────────────────────────────────────────
    PCE surr. (adap. MH):
        wall time: .................................. 117.08s
        (avg.) time per iteration: .................. 0.0078s
        effective sample size (min.): ............... 608 / 15000
        true model eval.: ........................... 240
        fitting time: ............................... 20.0727s
        true mod. eval. during fitting: ............. 64
    ────────────────────────────────────────────────────────────
    GPR surr. (adap. MH):
        wall time: .................................. 98.89s
        (avg.) time per iteration: .................. 0.0066s
        effective sample size (min.): ............... 440 / 15000
        true model eval.: ........................... 240
        fitting time: ............................... 61.6650s
        true mod. eval. during fitting: ............. 200
    
    i.e. a speedup of roughly 186 times for the surrogate presented by the authors versus a speedup of 220 times for our gaussian process surrogate;

the first example is extensively documented in the relative Jupyter notebook (you can find it here);
for the second example we opted for a more traditional script, since its runtime is around 6 hours on a laptop and it leaves little space for interactivity (if you're feeling bored while running it and your device allows for interactive plotting, check out this script enabling real-time traceplots!).


References

About


Languages

Language:Jupyter Notebook 88.4%Language:Python 11.6%