models.markov_series()
Sample a Markov (state-space) latent over the full horizon.
Usage
models.markov_series(
h,
name,
init_carry,
transition,
xs=None,
*,
advance=None,
plates=(),
reparam_config=None
)In-sample steps run in a numpyro.contrib.control_flow.scan with site name; when forecasting, horizon steps run in a second scan with site f"{name}_future" seeded by the final in-sample carry. The guide never sees the future site (same invariant as innovations()), and under posterior replay the carry is a deterministic function of the replayed draws, so the forecast is conditioned through the state.
Parameters
h: Horizon-
The horizon for the current model call (see Horizon).
name: str-
Base sample-site name for the in-sample latent scan.
init_carry: Carry-
Initial carry passed to the first transition.
transition: Transition[Carry]-
Per-step
(carry, x_t) -> dist_tcallable returning the distribution of the next latent (see Transition); the wrapper owns thenumpyro.samplestatement. xs: PyTree[Array] | None = None-
Optional exogenous inputs over the full horizon: a PyTree of arrays with time at axis
-2(a single array, a tuple, a dict, …), moved leaf by leaf into scan layout internally;Nonefor autonomous dynamics. advance: Advance[Carry] | None = None-
Optional
(carry, z_t, x_t) -> carry(see Advance) that builds the next carry from the sampled latent;Nonemeans the carry is the latent,carry_{t+1} = z_t, soinit_carrymust be a single array shaped like one draw. A vector autoregression withplags keeps a(p, obs)window here. plates: Sequence[tuple[str, int]] = ()-
(name, size)pairs opened inside the scan body around the sample statement (the only placement NumPyro supports for scan + plate). reparam_config: Mapping[str, Reparam] | None = None-
Site-name ->
numpyro.infer.reparam.Reparammapping applied inside the scan body.
Returns
Array-
The latent over the full horizon in package layout
(*plate_batch, duration, obs).
Raises
ValueError-
If forecasting without observed data (only reachable with a hand-built Horizon: Horizon.from_data() never sets
future > 0without data), if the per-step shape lacks the observation dimension, if an enclosing plate is detected, or ifadvanceis omitted andinit_carryis not a single array with the shape and dtype of a draw.