Rejection ABC sampler¶
- class pints.RejectionABC(log_prior)[source]¶
Implements the rejection ABC algorithm as described in [1].
Here is a high-level description of the algorithm:
\[\begin{split}\begin{align} \theta^* &\sim p(\theta) \\ x &\sim p(x|\theta^*) \\ \textrm{if } s(x) < \textrm{threshold}, \textrm{then} \\ \theta^* \textrm{ is added to list of samples} \\ \end{align}\end{split}\]In other words, the first two steps sample parameters from the prior distribution \(p(\theta)\) and then sample simulated data from the sampling distribution (conditional on the sampled parameter values), \(p(x|\theta^*)\). In the end, if the error measure between our simulated data and the original data is within the threshold, we add the sampled parameters to the list of samples.
References
- ask(n_samples)[source]¶
See
ABCSampler.ask()
.
- n_hyper_parameters()¶
Returns the number of hyper-parameters for this method (see
TunableMethod
).
- set_hyper_parameters(x)¶
Sets the hyper-parameters for the method with the given vector of values (see
TunableMethod
).- Parameters:
x – An array of length
n_hyper_parameters
used to set the hyper-parameters.
- set_threshold(threshold)[source]¶
Sets threshold error distance that determines if a sample is accepted (if
error < threshold
).
- tell(fx)[source]¶
See
ABCSampler.tell()
.