ABC Advanced Reference
Advanced aspects of GpABC support for parameter estimation with Approximate Bayesian Computation.
Index
GpABC.AbstractEmulatedParticleSelectionGpABC.AbstractEmulatorRetrainingGpABC.AbstractEmulatorTrainingGpABC.DefaultEmulatorTrainingGpABC.IncrementalRetrainingGpABC.MeanEmulatedParticleSelectionGpABC.MeanVarEmulatedParticleSelectionGpABC.NoopRetrainingGpABC.PosteriorSampledEmulatedParticleSelectionGpABC.PreviousPopulationRetrainingGpABC.PreviousPopulationThresholdRetrainingGpABC.abc_retrain_emulatorGpABC.abc_select_emulated_particlesGpABC.train_emulator
Types and Functions
GpABC.AbstractEmulatorTraining — Type.AbstractEmulatorTrainingSubtypes of this abstract type control how the emulator is trained for emulation-based ABC algorithms (rejection and SMC). At the moment, only DefaultEmulatorTraining is shipped. Custom emulator training procedure can be implemented by creating new subtypes of this type and overriding train_emulator for them.
A typical use case would be trying to control the behaviour of gp_train more tightly, or not using it altogeather (e.g. using another optimisation package).
GpABC.DefaultEmulatorTraining — Type.DefaultEmulatorTraining <: AbstractEmulatorTrainingFields
kernel::AbstractGPKernel: the kernel (AbstractGPKernel) that will be used with the Gaussian Process (GPModel). Defaults toSquaredExponentialArdKernel.
train_emulator method with this argument type calls gp_train with default arguments.
AbstractEmulatedParticleSelectionSubtypes of this type control the criteria that determine what particles are included in the posterior for emulation-based ABC. Custom strategies can be implemented by creating new subtypes of this type and overriding abc_select_emulated_particles for them.
Three implementations are shipped:
MeanVarEmulatedParticleSelection <: AbstractEmulatedParticleSelectionWhen this strategy is used, the particles for which both mean and standard deviation returned by gp_regression is below the ABC threshold are included in the posterior. In pseudocode:
means, vars = gp_regression(parameters, gpm)
accepted_indices = findall((means .<= threshold) .& (sqrt.(vars) .<= threshold))The rationale behind using this selection strategy is to take into account the "level of uncertainty" about the regression prediction that is provided by the Gaussian Process in form of standard deviation. So, even if the mean of the GP is below the threshold, but the GP is "uncertain" about it (i.e. the variance is high), this particle will not be included in the posterior distribution of ABC. It is a more stringent acceptance criteria than MeanEmulatedParticleSelection.
Fields
variance_threshold_factor: scaling factor, by which the ABC threshold is multiplied
before checking the standard deviation. Defaults to 1.0.
MeanEmulatedParticleSelection <: AbstractEmulatedParticleSelectionWhen this strategy is used, the particles for which only the mean value returned by gp_regression is below the ABC threshold are included in the posterior. Variance is not checked.
PosteriorSampledEmulatedParticleSelection <: AbstractEmulatedParticleSelectionWhen this strategy is used, the distance is sampled from the GP posterior of the gp_regression object. If the sampled distance is below the threshold the particle is accepted.
Fields
use_diagonal_covariance: iftrue, the GP posterior covariance will be approximated by its
diagonal elements only. Defaults to false.
GpABC.AbstractEmulatorRetraining — Type.AbstractEmulatorRetrainingSubtypes of this abstract type control the additional retraining procedure that may or may not be carried out before each iteration of emulation-based ABC. Custom strategies may be implemented by creating new subtypes of this type and new abc_retrain_emulator methods for them.
The following implementations are shipped:
GpABC.IncrementalRetraining — Type.IncrementalRetraining <: AbstractEmulatorRetrainingThis emulator retraining strategy samples extra particles from the previous population, and adds them to the set of design points that were used on the previous iteration. The new design points are filtered according to the threshold. The combined set of design points is used to train the new emulator.
Fields
design_points: number of design points to add on each iterationmax_simulations: maximum number of simulations to perform during re-trainging on each iteration
PreviousPopulationRetraining <: AbstractEmulatorRetrainingThis emulator retraining strategy samples extra particles from the previous population, and uses them to re-train the emulator from scratch. No filtering of the new design points is performed. Design points from the previous iteration are discarded.
PreviousPopulationThresholdRetraining <: AbstractEmulatorRetrainingThis emulator retraining strategy samples extra particles from the previous population, and uses them to re-train the emulator from scratch. Design points from the previous iteration are discarded. This strategy allows to control how many design points are sampled with distance to the reference data below the threshold.
Fields:
n_design_points: number of design pointsn_below_threshold: number of design points below the thresholdmax_iter: maximum number of simulations to perform on each re-training iteration
GpABC.NoopRetraining — Type.NoopRetraining <: AbstractEmulatorRetrainingA sentinel retraining strategy that does not do anything. When used, the emulator is trained only once at the start of the process.
GpABC.train_emulator — Function.train_emulator(training_x, training_y, emulator_training<:AbstractEmulatorTraining)Train the emulator. For custom training procedure, a new subtype of AbstractEmulatorTraining should be created, and a method of this function should be created for it.
Returns
A trained emulator. Shipped implementations return a GPModel.
GpABC.abc_retrain_emulator — Function.abc_retrain_emulator(
gp_model,
particle_sampling_function,
epsilon,
training_input::EmulatorTrainingInput,
retraining_settings<:AbstractEmulatorRetraining
)Additional retraining procedure for the emulator that may or may not be executed before every iteration of emulation based ABC. Details of the procedure are determined by the subtype of AbstractEmulatorRetraining that is passed as an argument.
GpABC.abc_select_emulated_particles — Function.abc_select_emulated_particles(emulator, particles, threshold, selection<:AbstractEmulatedParticleSelection)Compute the approximate distances by running the regression-based emulator on the provided particles, and return the accepted particles. Acceptance strategy is determined by selection - subtype of AbstractEmulatedParticleSelection.
Arguments
gpm: theGPModel, that contains the training data (x and y), the kernel, the hyperparameters and the test data for running the regression.parameters: array of parameters to test (the particles).threshold: if the distance for a particle is belowthresholdthen it is accepted as a posterior sample.selection: the acceptance strategy (a subtype ofAbstractEmulatedParticleSelection). This determines the method by which an emulated distance is accepted.
Return
A tuple of accepted distances, and indices of the accepted particles in the supplied particles array.