pymc_forecast.gaussian#
Correlated-over-time observation noise: the Gaussian prefix conditional.
For elementwise noise the forecast distribution is the horizon marginal (what
predict() does implicitly). When the observation
noise is a MultivariateNormal over the time axis — GP-style correlated
residuals — the forecast must instead be the Gaussian conditional given the
observed prefix. This module ports numpyro_forecast’s _mvn_prefix_condition
(Cholesky of the prefix block, triangular solves for the conditional mean and
covariance, jitter + symmetrization) to PyTensor and wires it into a
predict-style primitive.
Univariate series only (the MVN event dimension is time), matching upstream.
- pymc_forecast.gaussian.conditional_mvn(loc, cov, observed_prefix, *, jitter=1e-06)[source]#
Condition a length-
t+fMVN on its firsttobserved values.- Parameters:
loc – Full-horizon mean, shape
(t + f,).cov – Full-horizon covariance, shape
(t + f, t + f).observed_prefix – Observed values, shape
(t,).jitter – Diagonal floor added to the prefix and conditional covariances.
- Returns:
(cond_mean,cond_cov)– Mean(f,)and covariance(f, f)of the forecast conditional.
- pymc_forecast.gaussian.predict_mvn(h, loc, cov, *, jitter=1e-06)[source]#
Register MVN-over-time observation/forecast variables.
The correlated-noise counterpart of
predict(): the likelihood isMvNormalover the observed window (the prefix block ofcov) and — when forecasting — the"forecast"variable is the exact Gaussian conditional given the observed prefix, not the horizon marginal.- Parameters:
h – The horizon of the current model build.
loc – Full-horizon mean with shape
(duration,)(time on axis 0).cov – Full-horizon covariance with shape
(duration, duration)— e.g. a GP kernel gram matrix over the time positions.jitter – Diagonal floor for numerical stability.
- Raises:
HorizonError – For multivariate data (the MVN event dim must be time) or when forecasting without observed data.