iscc.inference.ABC ¶
Approximate Bayesian Computation engine for fitting model parameters.
Model-agnostic and dependency-light (numpy + scikit-learn + scipy — no JAX, no R).
Given a Prior and a simulate(theta) -> summary_vector
callback, it builds a reference table, keeps the accept_frac closest draws to the
observed summary, and returns a Posterior — with optional
Beaumont et al. (2002) local-linear regression adjustment and a Random-Forest point
estimate (the Python analogue of CINner's ABC-rf). The simulate callback is supplied
by the caller (for the tumour model, the iscc.inference package wires one up).
Call run with the observed summary vector to obtain the posterior.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prior
|
Prior
|
Product prior over the named parameters to infer (see |
required |
simulate
|
callable
|
|
required |
n_workers
|
int
|
Number of processes used to parallelise the simulations (default 1 = serial). |
1
|
seed
|
int
|
Seed for the engine's random generator (default 0). |
0
|
Methods:
| Name | Description |
|---|---|
reference_table |
Draw |
run |
Run ABC against |
reference_table ¶
Draw n_samples priors and simulate them -> (theta, summaries) (failures dropped).
run ¶
Run ABC against observed -> Posterior.
reference optionally reuses a precomputed (theta, summaries) table (so the same
sims can serve several observations). accept_frac sets the rejection tolerance.
project="rf" enables semi-automatic ABC (Fearnhead & Prangle 2012): a random
forest is fit to map summaries -> parameters, and the rejection/regression step runs in
that low-dimensional predicted-parameter space. Each projected coordinate targets one
parameter on a comparable scale, so a single clean summary can no longer dominate the
distance and starve the others (the failure mode of raw standardised-Euclidean matching
when parameters are identified by different summaries). project=None uses the raw
standardised summaries. The reference table is projected through the forest's
out-of-bag predictions to avoid the train-on / match-on double-dip.