Reference / binference.samplers.Bootstrap
binference.samplers.Bootstrap¶
- class binference.samplers.Bootstrap(model, *, scheme='nonparametric', tol=1e-08, max_iter=5000, rng=None, progress=False)[source]¶
Bootstrap over objects of the MAP / maximum-likelihood estimator.
scheme="nonparametric"resamples objects with replacement;scheme="bayesian"reweights them with Dirichlet weights (Rubin 1981). Integer weights are multiplicities, so a row of weightwstands forwobjects that are resampled individually. For rate models the number of objects is itself random: objects get Poisson(1) counts (or Gamma(1) weights), so the total rate varies between replicates. Every replicate is fitted from an interior starting point;info["n_not_converged"]counts the replicates whose fit did not converge (a warning names it).The result is the sampling distribution of an estimator, not a posterior: it is flagged
approximate=True. Useful for frequentist intervals and comparisons with unfolding / empirical-Bayes practice.- Parameters:
- modelPopulationModel
- scheme{“nonparametric”, “bayesian”}, optional
Resample objects (
"nonparametric") or reweight them with Dirichlet weights ("bayesian").- tolfloat, optional
KKT tolerance of each replicate’s MAP fit.
- max_iterint, optional
Most iterations of each replicate’s MAP fit.
- rngint, Generator or None
Random number generator.
- progressbool, optional
Show a progress bar.
- __init__(model, *, scheme='nonparametric', tol=1e-08, max_iter=5000, rng=None, progress=False)[source]¶
Methods
__init__(model, *[, scheme, tol, max_iter, ...])run([n_samples])Return
n_samplesbootstrap replicates of the estimate.unsupported(model)Why the engine cannot run on
model, orNonewhen it can.Attributes
approximatejointwhether 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