Particle sampling algorithms
Particle sampling algorithms are a class of Monte Carlo methods that approximate a target distribution through a set of "particles" or points in the parameter space which are weighted or evolved according to some update rule. The stationary distribution of the particles after some number of updates then typically corresponds to the target. In the setting of Bayesian inference, the target distribution is the posterior.
The simplest form of particle method is importance sampling which reweights samples from a so-called proposal distribution. If the proposal is taken to be the prior and the weighting function is simply the likelihood, the resulting weighted samples will approximately follow the posterior distribution. This is implemented in SimulationBasedInference as the "ensemble importance sampling" (EnIS) algorithm:
SimulationBasedInference.EnIS — Type
EnISBasic ensemble importance sampling (EnIS) inference algorithm. Also sometimes referred to as the "particle batch smoother" (PBS) or "generalized likelihood uncertainty estimation" (GLUE) depending on the context.
where "ensemble" here refers to the collection of particles used for the Monte Carlo approximation.
Naive importance sampling algorithms tend to be very inefficient when applied to high-dimensional or highly nonlinear systems.
For fully Gaussian problems (i.e., Gaussian prior and likelihood), Kalman-type methods are a much more efficient alternative.
SimulationBasedInference currently provides two ensemble Kalman-type algorithms; the first is the Ensmeble Kalman Sampler (EKS; Garbuno-Inigo et al. 2020):
SimulationBasedInference.EKS — Type
EKS{NF} <: EnsembleInferenceAlgorithmRepresents a proxy for the Ensemble Kalman Sampler (Garbuno-Inigo et al. 2020) implementation provided by EnsembleKalmanProcesses.
and the second is the Ensemble Smoother with Multiple Data Assimilation (ES-MDA; Emerick and Reynolds 2013):
SimulationBasedInference.ESMDA — Type
ESMDA{NF} <: EnsembleInferenceAlgorithmImplementation of the ensemble-smother multiple data assimilation algorithm of Emerick et al. 2013.
Emerick, Alexandre A., and Albert C. Reynolds. "Ensemble smoother with multiple data assimilation." Computers & Geosciences 55 (2013): 3-15.
Ensemble interface methods
All EnsembleInferenceAlgorithms implement the following method interface:
SimulationBasedInference.get_ensemble — Method
get_ensemble(state::EnsembleState)Retrieves the current ensemble matrix from the given EnsembleState. Must be implemented for each ensemble algorithm state type.
SimulationBasedInference.isiterative — Method
isiterative(alg::EnsembleInferenceAlgorithm)Returns true if the given ensemble inference algorithm is iterative, false otherwise. Default implementation returns false (non-iterative).
SimulationBasedInference.hasconverged — Method
hasconverged(alg::EnsembleInferenceAlgorithm, state::EnsembleState)Should return true when alg at the current state has converged, false otherwise. Must be implemented for each ensemble algorithm state type.
SimulationBasedInference.initialstate — Method
initialstate(
alg::EnsembleInferenceAlgorithm,
ens::AbstractMatrix,
obs::AbstractVector,
obscov::AbstractMatrix;
rng::AbstractRNG=Random.GLOBAL_RNG
)Constructs the initial ensemble state for the given algorithm and observations.
SimulationBasedInference.ensemblestep! — Method
ensemblestep!(solver::EnsembleSolver{algType}) where {algType}Executes a single ensemble step (forward solve + update) for the given algorithm type. Must be implemented by all ensemble algorithm implementations.
SimulationBasedInference.finalize! — Method
finalize!(solver::EnsembleSolver)Finalizes the solver state after iteration has completed. Default implementation runs ensemble_solve on the current ensemble state and stores the results in sol.storage.
EnsembleState is an abstract type which must be subtyped by each ensemble algorithm implementation.
SimulationBasedInference.EnsembleState — Type
EnsembleStateBase type for ensemble inference algorithm state implementations.
EnsembleSolver acts as a container for all of the common components shared by all ensemble algorithms.
SimulationBasedInference.EnsembleSolver — Type
EnsembleSolver{algType,probType,ensalgType,stateType<:EnsembleState,kwargTypes}Generic implementation of an iterative solver for any ensemble-based algorithm. Uses the SciML EnsembleProblem interface to automatically parallelize forward runs over the ensemble.
Utility methods
The following utility methods are also provided
SimulationBasedInference.get_transformed_ensemble — Method
get_transformed_ensemble(sol::EnsembleInferenceSolution, iter::Int=length(sol.storage))Fetches the transformed ensemble from the given solution object. For iterative algorithms, the optinal argument iter may be provided, which then retrieves the ensemble at the given iteration.
SimulationBasedInference.get_observables — Method
get_observables(sol::EnsembleInferenceSolution, iter::Int=length(sol.storage))Returns a NamedTuple of the ensemble simulated observables at iteration iter.
Internally, the algorithms use the method ensemble_forward to apply the necessary parameter transforms and call solve on the resulting ensemble: