Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/madsjulia/AffineInvariantMCMC.jl
Affine Invariant Markov Chain Monte Carlo (MCMC) Ensemble sampler
https://github.com/madsjulia/AffineInvariantMCMC.jl
affine-invariance ensemble-sampler high-performance-computing julia mads markov-chain markov-chain-monte-carlo mcmc monte-carlo-simulation uncertainty uncertainty-estimation uncertainty-quantification
Last synced: 3 months ago
JSON representation
Affine Invariant Markov Chain Monte Carlo (MCMC) Ensemble sampler
- Host: GitHub
- URL: https://github.com/madsjulia/AffineInvariantMCMC.jl
- Owner: madsjulia
- License: other
- Created: 2016-10-04T13:55:01.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-05-06T13:28:01.000Z (6 months ago)
- Last Synced: 2024-07-06T16:08:55.468Z (4 months ago)
- Topics: affine-invariance, ensemble-sampler, high-performance-computing, julia, mads, markov-chain, markov-chain-monte-carlo, mcmc, monte-carlo-simulation, uncertainty, uncertainty-estimation, uncertainty-quantification
- Language: Julia
- Homepage: http://mads.gitlab.io
- Size: 740 KB
- Stars: 31
- Watchers: 8
- Forks: 9
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-sciml - madsjulia/AffineInvariantMCMC.jl: Affine Invariant Markov Chain Monte Carlo (MCMC) Ensemble sampler
README
AffineInvariantMCMC
===================AffineInvariantMCMC performs Bayesian sampling using Goodman & Weare's Affine Invariant Markov Chain Monte Carlo (MCMC) Ensemble sampler.
AffineInvariantMCMC is a module of [MADS](http://madsjulia.github.io/Mads.jl).
Goodman & Weare's algorithm implementation in Python is called [Emcee](http://dan.iel.fm/emcee).[![Coverage Status](https://coveralls.io/repos/madsjulia/AffineInvariantMCMC.jl/badge.svg?branch=master)](https://coveralls.io/r/madsjulia/AffineInvariantMCMC.jl?branch=master)
Reference:
Goodman, Jonathan, and Jonathan Weare. "Ensemble samplers with affine invariance." Communications in applied mathematics and computational science 5.1 (2010): 65-80. [Link](http://msp.org/camcos/2010/5-1/p04.xhtml)
Installation
-----------```julia
import Pkg; Pkg.add("AffineInvariantMCMC")
```Example
--------```julia
import AffineInvariantMCMCnumdims = 5
numwalkers = 100
thinning = 10
numsamples_perwalker = 1000
burnin = 100const stds = exp(5 * randn(numdims))
const means = 1 + 5 * rand(numdims)
llhood = x->begin
retval = 0.
for i = eachindex(x)
retval -= .5 * ((x[i] - means[i]) / stds[i]) ^ 2
end
return retval
end
x0 = rand(numdims, numwalkers) * 10 - 5
chain, llhoodvals = AffineInvariantMCMC.sample(llhood, numwalkers, x0, burnin, 1)
chain, llhoodvals = AffineInvariantMCMC.sample(llhood, numwalkers, chain[:, :, end], numsamples_perwalker, thinning)
flatchain, flatllhoodvals = AffineInvariantMCMC.flattenmcmcarray(chain, llhoodvals)
```Comparison
----------The figures below compare predicted marginal and joint posterior PDF's (probability density functions) using Classical vs. Affine Invariant MCMC for the same number of functional evaluations (in this case 1,000,000).
The synthetic problem tested below is designed to have a very complex structure.
The Classical MCMC clearly fails to characterize sufficiently well the posterior PDF's.- Classical MCMC ![ClassicalMCMC](/examples/ClassicalMCMC_w1000000.png)
- Affine Invariant MCMC ![AffineInvariantMCMC](/examples/AffineInvariantMCMC_w1000000.png)The codes applied to perform these analyses are available here:
- [Classical MCMC](https://github.com/madsjulia/Mads.jl/blob/master/examples/model_analysis/bayes_weight_analsis.jl)
- [Affine Invariant MCMC](https://github.com/madsjulia/Mads.jl/blob/master/examples/model_analysis/emcee_weight_analsis.jl)Parallelization
---------------AffineInvariantMCMC can be executed efficiently in parallel using existing distributed network capabilities.
For more information, check out our Julia module [RobustPmap](https://github.com/madsjulia/RobustPmap.jl).
Restarts
--------AffineInvariantMCMC analyses can be performed utilizing extremely efficient restarts.
Typically, the AffineInvariantMCMC runs require a large number of functional (model) evaluations which may take substantial computational time.
Occasionally, the AffineInvariantMCMC runs may crash due to external issues (e.g., network/computer/disk failures).
Furthermore, AffineInvariantMCMC runs may require more time than the allowed allocation time on existing HPC cluster queues.
In all these cases, the AffineInvariantMCMC runs need to be restarted.
Our codes allow for efficient restarts with very minimal overhead and without re-execution of completed functional (model) evaluations.For more information, check out our Julia module [ReusableFunctions](https://github.com/madsjulia/ReusableFunctions.jl).
Documentation
-------------All the available MADS modules and functions are described at [madsjulia.github.io](http://madsjulia.github.io/Mads.jl)
AffineInvariantMCMC functions are documented at [https://madsjulia.github.io/Mads.jl/Modules/AffineInvariantMCMC](https://madsjulia.github.io/Mads.jl/Modules/AffineInvariantMCMC)
Projects using AffineInvariantMCMC
-----------------Projects using AffineInvariantMCMC
-----------------* [MADS](https://github.com/madsjulia)
* [SmartTensors](https://github.com/SmartTensors)
* [SmartML](https://github.com/SmartTensors/SmartML.jl)Publications, Presentations, Projects
--------------------------* [mads.gitlab.io](http://mads.gitlab.io)
* [madsjulia.github.io](https://madsjulia.github.io)
* [SmartTensors](https://SmartTensors.github.io)
* [SmartTensors.com](https://SmartTensors.com)
* [monty.gitlab.io](http://monty.gitlab.io)
* [montyv.github.io](https://montyv.github.io)