esem.abc_sampler.ABCSampler

class esem.abc_sampler.ABCSampler(model, obs, obs_uncertainty=0.0, interann_uncertainty=0.0, repres_uncertainty=0.0, struct_uncertainty=0.0, abs_obs_uncertainty=0.0, abs_interann_uncertainty=0.0, abs_repres_uncertainty=0.0, abs_struct_uncertainty=0.0)

Sample from the posterior using Approximate Bayesian Computation (ABC). This is a style of rejection sampling.

Notes

Note that emulator samples compared to NaN observations are always treated as ‘plausible’.

__init__(model, obs, obs_uncertainty=0.0, interann_uncertainty=0.0, repres_uncertainty=0.0, struct_uncertainty=0.0, abs_obs_uncertainty=0.0, abs_interann_uncertainty=0.0, abs_repres_uncertainty=0.0, abs_struct_uncertainty=0.0)
Parameters
  • model (esem.emulator.Emulator)

  • obs (iris.cube.Cube or array-like) – The objective

  • obs_uncertainty (float) – Fractional, relative (1 sigma) uncertainty in observations

  • repres_uncertainty (float) – Fractional, relative (1 sigma) uncertainty due to the spatial and temporal representitiveness of the observations

  • interann_uncertainty (float) – Fractional, relative (1 sigma) uncertainty introduced when using a model run for a year other than that the observations were measured in.

  • struct_uncertainty (float) – Fractional, relative (1 sigma) uncertainty in the model itself.

  • abs_obs_uncertainty (float) – Fractional, absolute (1 sigma) uncertainty in observations

  • abs_repres_uncertainty (float) – Fractional, absolute (1 sigma) uncertainty due to the spatial and temporal representitiveness of the observations

  • abs_interann_uncertainty (float) – Fractional, absolute (1 sigma) uncertainty introduced when using a model run for a year other than that the observations were measured in.

  • abs_struct_uncertainty (float) – Fractional, absolute (1 sigma) uncertainty in the model itself.

Methods

__init__(model, obs[, obs_uncertainty, …])

Parameters

batch_constrain(sample_points[, tolerance, …])

Constrain the supplied sample points based on the tolerance threshold, optionally in bathes.

get_implausibility(sample_points[, batch_size])

Calculate the implausibility of the provided sample points, optionally in batches.

sample([prior_x, n_samples, tolerance, …])

Sample the emulator over prior_x and compare with the observations, returning n_samples of the posterior distribution (those points for which the model is compatible with the observations).