Reference / binference.inference.Auto
binference.inference.Auto¶
- class binference.inference.Auto(model, *, target_ess=400.0, max_gibbs_missing=0.98, max_nnz=20000000.0, max_gibbs_draws=25000, extend_target=1.2, extend_max_factor=3.0, extend_min_factor=0.5, probe_proposals=1000, probe_draws=500, probe_ess_share=0.5, 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.
- max_gibbs_missingfloat
Largest missing-information fraction for which Gibbs is chosen (0.98: an integrated autocorrelation time of 99 iterations).
- max_nnzfloat
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.
- extend_targetfloat
An extension of a Gibbs run aims for this many times
target_ess.- extend_max_factor, extend_min_factorfloat
One extension of a Gibbs run adds at most and at least these many times the draws so far.
- probe_proposals, probe_drawsint
Proposals and draws of the first pass that can stop a Laplace trial early.
- probe_ess_sharefloat
A Laplace trial stops when its first pass projects an importance ESS below this share of
target_ess.- rng, progress
As for every engine.
- **engine_kwargs
Options for the chosen engine. Auto makes each engine it may run when it is made, so that each checks them at once.
- __init__(model, *, target_ess=400.0, max_gibbs_missing=0.98, max_nnz=20000000.0, max_gibbs_draws=25000, extend_target=1.2, extend_max_factor=3.0, extend_min_factor=0.5, probe_proposals=1000, probe_draws=500, probe_ess_share=0.5, 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
whether the engine infers a selection from injections or a tallied response jointly
markovwhether its draws are Markov chains, described by R-hat and ESS
- candidates(n_samples=None)[source]¶
(engine, reason, Gibbs draws per chain) in the order they are tried.
- Parameters:
- n_samplesint, optional
Least 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