Reference / binference.inference.Auto
binference.inference.Auto¶
- class binference.inference.Auto(model, *, target_ess=400.0, gibbs_max_missing=0.98, nnz_limit=20000000.0, max_gibbs_draws=25000, rng=None, progress=False, **engine_kwargs)[source]¶
Picks Gibbs, Laplace or NUTS from rules set by a benchmark of the engines.
It tries Gibbs where it mixes well, then importance-corrected Laplace where its check passes, then NUTS, keeping only engines that take every option in
engine_kwargs. How auto chooses states the rules and the benchmark. The result records the choice and the reason ininfo["auto_method"]andinfo["auto_reason"].- Parameters:
- modelPopulationModel
- target_essfloat
Smallest bulk ESS that Gibbs’s run length aims for and that Laplace’s importance ESS must reach.
- gibbs_max_missingfloat
Largest missing-information fraction for which Gibbs is chosen (0.98: an integrated autocorrelation time of 99 iterations).
- nnz_limitfloat
Above this many stored likelihood entries Laplace is kept even when its check fails, rather than running NUTS.
- max_gibbs_drawsint
Most draws per chain a Gibbs run may be extended to before it gives way to the next candidate.
- rng, progress
As for every engine.
- **engine_kwargs
Options for the chosen engine.
- __init__(model, *, target_ess=400.0, gibbs_max_missing=0.98, nnz_limit=20000000.0, max_gibbs_draws=25000, rng=None, progress=False, **engine_kwargs)[source]¶
Methods
__init__(model, *[, target_ess, ...])candidates([n_samples])(engine, reason, Gibbs draws per chain) in the order they are tried.
run([n_samples])Run the first candidate that applies (see the class docstring).
unsupported(model)Why the engine cannot run on
model, orNonewhen it can.Attributes
approximatewhether the engine infers a selection from injections or a tallied response jointly (DECISIONS #30, #80, #81)
markovwhether its draws are Markov chains, described by R-hat and ESS
name- candidates(n_samples=None)[source]¶
(engine, reason, Gibbs draws per chain) in the order they are tried.
- Parameters:
- n_samplesint, optional
Draws per chain of the runs;
Noneuses the engines’ own lengths.
- joint = True¶
whether the engine infers a selection from injections or a tallied response jointly (DECISIONS #30, #80, #81)