Reference
Forecasters
High-level interfaces for fitting and forecasting.
- forecaster.Forecaster
-
Fit a forecasting model with stochastic variational inference.
- forecaster.HMCForecaster
-
Fit a forecasting model with NUTS (Hamiltonian Monte Carlo).
Models
Building forecasting models (object-oriented and functional).
- forecaster.ForecastingModel
-
Abstract base class for forecasting models.
- functional.forecasting_model()
-
Build a NumPyro model from a functional model body.
Functional core
Pure functional primitives for the train/forecast split.
- functional.Horizon
-
The train/forecast split for a single model call.
- functional.time_series()
-
Sample a time-varying latent over the full horizon.
- functional.predict()
-
Register the observation/forecast sites for the model.
- functional.fit_svi()
-
Fit a forecasting model with stochastic variational inference.
- functional.draw_posterior()
-
Draw
num_samplesposterior samples of the latent sites from a fit. - functional.fit_mcmc()
-
Fit a forecasting model with NUTS (Hamiltonian Monte Carlo).
- functional.forecast()
-
Sample forecasts for the steps in
[t, duration)from a posterior. - functional.predict_in_sample()
-
Sample the in-sample posterior predictive of the
obssite. - functional.SVIFit
-
The result of fitting a forecasting model with SVI.
- functional.MCMCFit
-
The result of fitting a forecasting model with MCMC (NUTS).
Backtesting & evaluation
Rolling-window backtesting and forecast metrics.
- evaluate.backtest()
-
Backtest a forecasting model on a moving window of
(train, test)data. - evaluate.BacktestResult
-
Per-window result of a
backtest()run. - evaluate.evaluate_forecast()
-
Evaluate forecast samples against ground truth for several metrics at once.
- evaluate.eval_crps()
-
Empirical CRPS averaged over all data elements.
- evaluate.eval_mae()
-
Mean absolute error using the forecast sample median as point estimate.
- evaluate.eval_rmse()
-
Root mean squared error using the forecast sample mean as point estimate.
- evaluate.eval_coverage()
-
Empirical coverage of the central
alphaprediction interval. - metrics.crps_empirical()
-
Compute the empirical Continuous Ranked Probability Score (CRPS).
Utilities
Array helpers and feature builders.
- util.fourier_features()
-
Build a Fourier seasonality design matrix.
- util.periodic_repeat()
-
Tile a seasonal pattern to cover
durationtime steps. - util.zero_data_like()
-
Return zeros shaped like
databut extended to the covariate duration. - util.concat_future()
-
Concatenate in-sample and forecast-horizon arrays along the time axis.
- util.shift_loc()
-
Re-center a zero-centered noise distribution at
loc. - util.slice_time()
-
Slice an elementwise distribution along the time axis
-2. - util.prefix_condition()
-
Condition a
(t+f)-length distribution on at-length data prefix.
Datasets
Example datasets used in the tutorials.
- datasets.load_bart_weekly()
-
Load total weekly BART ridership (log scale) for the univariate example.
- datasets.load_bart_hierarchical()
-
Load the windowed hierarchical BART panel for the hierarchical example.
- datasets.load_victoria_electricity()
-
Load hourly Victoria (Australia) electricity demand and temperature.
- datasets.bart_available()
-
Return whether the BART dataset can be loaded (download succeeds).