ReconcilerForecaster
Hierarchical reconciliation forecaster.
Reconciliation is applied to make the forecasts in a hierarchy of time-series sum together appropriately.
The base forecasts are first generated for each member separately in the hierarchy using any forecaster. The base forecasts are then reonciled so that they sum together appropriately. This reconciliation step can often improve the skill of the forecasts in the hierarchy.
Please refer to [1] for further information.
Schnellstart
from sktime.forecasting.reconcile import ReconcilerForecaster
estimator = ReconcilerForecaster(forecaster, method='mint_shrink', return_totals=True, alpha=0)Parameter(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
Beispiele
>>> 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 ])