Forecaster
ReconcilerForecaster
Hierarchical reconciliation forecaster.
Quickstart
python
from sktime.forecasting.reconcile import ReconcilerForecaster
estimator = ReconcilerForecaster(forecaster, method='mint_shrink', return_totals=True, alpha=0)Parameters(4)
- forecasterestimator
- Estimator to generate base forecasts which are then reconciled
- method{“mint_cov”, “mint_shrink”, “ols”, “wls_var”, “wls_str”, “bu”, “td_fcst”}, default=”mint_shrink”
The reconciliation approach applied to the forecasts based on:
"mint_cov"- sample covariance"mint_shrink"- covariance with shrinkage"ols"- ordinary least squares"wls_var"- weighted least squares (variance)"wls_str"- weighted least squares (structural)"bu"- bottom-up"td_fcst"- top down based on forecast proportions
- return_totalsbool
Whether the predictions returned by
predictand predict-like methods should include the total values in the hierarchy, stored at the__totalindex levels.If True, prediction data frames include total values at
__totallevelsIf False, prediction data frames are returned without
__totallevels
- alpha: float default=0
- Optional regularization parameter to avoid singular covariance matrix
Examples
>>> from sktime.forecasting.naive import NaiveForecaster
>>> from sktime.forecasting.reconcile import ReconcilerForecaster
>>> from sktime.transformations.hierarchical.aggregate import Aggregator
>>> from sktime.utils._testing.hierarchical import _bottom_hier_datagen
>>> agg = Aggregator ()
>>> y = _bottom_hier_datagen (
... no_bottom_nodes = 3,
... no_levels = 1,
... random_seed = 123,
... length = 7,
... )
>>> y = agg. fit_transform (y)
>>> forecaster = NaiveForecaster (strategy = "drift")
>>> reconciler = ReconcilerForecaster (forecaster, method = "mint_shrink")
>>> reconciler. fit (y) ReconcilerForecaster(
... )
>>> prds_recon = reconciler. predict (fh = [1 ])References
- [1 ] https://otexts.com/fpp3/hierarchical.html