functional.draw_posterior()
Draw num_samples posterior samples of the latent sites from a fit.
Usage
functional.draw_posterior(
rng_key,
fit,
num_samples,
)Dispatches on the fit type (e.g. SVIFit, MCMCFit). The returned dict has the sample axis leading and is ready to pass to forecast() or NumPyro’s Predictive.
Parameters
rng_key: Array-
PRNG key.
fit: object-
A fit result produced by fit_svi() or fit_mcmc().
num_samples: int- Number of posterior draws.
Returns
dict[str, Array]- Posterior samples of the latent sites, sample axis leading.
Raises
NotImplementedError-
If
fitis of an unsupported type.
Notes
For an MCMCFit, when num_samples does not exceed the number of draws in the chain the draws are thinned on an evenly spaced grid (no duplicates); only when more samples are requested than the chain holds are they resampled with replacement. For an SVIFit the draws are sampled afresh from the fitted guide.