abc_calibrate

calibrate.abc_calibrate(
    simulator,
    priors,
    observed,
    *,
    population_size=200,
    max_populations=8,
    min_epsilon=0.0,
    n_posterior=None,
    seed=None,
    db_path=None,
)

Calibrate model parameters to observed targets with ABC-SMC.

Parameters

Name Type Description Default
simulator TargetSimulator Maps a parameter dict to simulated calibration targets (same keys as observed). required
priors Mapping[str, Distribution | Dirichlet] Parameter priors as heormodel distribution specs. required
observed Mapping[str, float] Observed calibration target values. required
population_size int Particles per ABC-SMC population. 200
max_populations int Maximum number of populations. 8
min_epsilon float Stop once the acceptance threshold reaches this value. 0.0
n_posterior int | None Rows in the returned equally-weighted posterior matrix (default: the final population size). None
seed int | None Seed for the weighted-to-equal resampling step. (The ABC run itself uses pyabc’s internal randomness.) None
db_path str | Path | None Where to store pyabc’s bookkeeping database (default: a temporary file). None

Returns

Name Type Description
CalibrationResult A CalibrationResult whose posterior plugs directly into
CalibrationResult the probabilistic analysis.

Example

from heormodel.calibrate import abc_calibrate # doctest: +SKIP from heormodel.params import Uniform result = abc_calibrate( # doctest: +SKIP … simulator=lambda p: {“prevalence”: p[“risk”] * 0.5}, … priors={“risk”: Uniform(0.0, 1.0)}, … observed={“prevalence”: 0.15}, … )