functional.forecasting_model()

Build a NumPyro model from a functional model body.

Usage

Source

functional.forecasting_model(model_fn)

The functional analogue of subclassing ~numpyro_forecast.forecaster.ForecastingModel. model_fn is a pure function (Horizon, covariates) -> None that calls time_series() and predict(); this wraps it into the standard NumPyro model callable (covariates, data=None), deriving the Horizon from the shapes.

Parameters

model_fn: Callable[[Horizon, Array], None]
The model body. It receives the per-call Horizon (use h.zero_data for the Pyro-style zero_data) and the covariates with time at axis -2.

Returns

ForecastModel
A callable (covariates, data=None) -> None usable with SVI, MCMC, Predictive, fit_svi(), fit_mcmc(), and the OOP forecaster classes.