functional.mcmc.fit_mcmc()
Fit a forecasting model with MCMC.
Usage
functional.mcmc.fit_mcmc(
rng_key,
model,
data,
covariates,
*,
kernel=None,
kernel_kwargs=None,
num_warmup=1000,
num_samples=1000,
num_chains=1,
chain_method="sequential",
progress_bar=False
)PRNG: consumed entirely by ~numpyro.infer.MCMC.
Parameters
rng_key: Array-
PRNG key for inference.
model: ForecastModel-
The forecasting model callable (OOP instance or functional model).
data: Array-
In-sample data with time at axis
-2. covariates: Array-
Covariates with time at axis
-2and the same duration asdata. kernel: KernelLike = None-
Kernel specification resolved by resolve_kernel():
None(NUTS), anMCMCKernelinstance, or anMCMCKernelsubclass. kernel_kwargs: Mapping[str, Any] | None = None-
Extra keyword arguments for the kernel constructor (only with
Noneor a kernel class; rejected with an instance). num_warmup: int = 1000-
Number of warmup steps.
num_samples: int = 1000-
Number of posterior samples.
num_chains: int = 1-
Number of MCMC chains (stored on the returned MCMCFit).
chain_method: str = "sequential"-
NumPyro chain method (
"sequential"/"parallel"/"vectorized"). progress_bar: bool = False- Whether to display the MCMC progress bar.
Returns
MCMCFit-
The posterior samples (flattened) and
num_chains.
Raises
ValueError-
If
dataandcovariateshave different durations. KernelConfigError-
If a run-config constraint is violated (see
_validate_kernel_run_config()).