hierarchicalforecast.methods
HReconciler
fit
fit_predict
predict
S
(np.ndarray): Summing matrix of size (base
, bottom
).y_hat
(np.ndarray): Forecast values of size (base
, horizon
).level
(Optional[list[int]], optional): float list 0-100, confidence levels for prediction intervals. Default is None.dict
: y_tilde: Reconciliated predictions.sample
intervals_method
selected during the reconcilerโs instantiation. Currently available: normality
, bootstrap
, permbu
.
Args:
num_samples
(int): number of samples generated from coherent distribution.np.ndarray
: samples: Coherent samples of size (num_series
, horizon
, num_samples
).BottomUp
Economic Review, 58 , 773(787)](http
: //www.jstor.org/stable/1815532).fit
S
(np.ndarray): Summing matrix of size (base
, bottom
).y_hat
(np.ndarray): Forecast values of size (base
, horizon
).idx_bottom
(np.ndarray): Indices corresponding to the bottom level of S
, size (bottom
).y_insample
(Optional[np.ndarray], optional): In-sample values of size (base
, horizon
). Default is None.y_hat_insample
(Optional[np.ndarray], optional): In-sample forecast values of size (base
, horizon
). Default is None.sigmah
(Optional[np.ndarray], optional): Estimated standard deviation of the conditional marginal distribution. Default is None.intervals_method
(Optional[str], optional): Sampler for prediction intervals, one of normality
, bootstrap
, permbu
. Default is None.num_samples
(Optional[int], optional): Number of samples for probabilistic coherent distribution. Default is None.seed
(Optional[int], optional): Seed for reproducibility. Default is None.tags
(Optional[dict[str, np.ndarray]], optional): Tags for hierarchical structure. Default is None.BottomUp
: object, fitted reconciler.fit_predict
S
(np.ndarray): Summing matrix of size (base
, bottom
).y_hat
(np.ndarray): Forecast values of size (base
, horizon
).idx_bottom
(np.ndarray): Indices corresponding to the bottom level of S
, size (bottom
).y_insample
(Optional[np.ndarray], optional): In-sample values of size (base
, insample_size
). Default is None.y_hat_insample
(Optional[np.ndarray], optional): In-sample forecast values of size (base
, insample_size
). Default is None.sigmah
(Optional[np.ndarray], optional): Estimated standard deviation of the conditional marginal distribution. Default is None.level
(Optional[list[int]], optional): float list 0-100, confidence levels for prediction intervals. Default is None.intervals_method
(Optional[str], optional): Sampler for prediction intervals, one of normality
, bootstrap
, permbu
. Default is None.num_samples
(Optional[int], optional): Number of samples for probabilistic coherent distribution. Default is None.seed
(Optional[int], optional): Seed for reproducibility. Default is None.tags
(Optional[dict[str, np.ndarray]], optional): Tags for hierarchical structure. Default is None.dict
: y_tilde: Reconciliated y_hat using the Bottom Up approach.predict
S
(np.ndarray): Summing matrix of size (base
, bottom
).y_hat
(np.ndarray): Forecast values of size (base
, horizon
).level
(Optional[list[int]], optional): float list 0-100, confidence levels for prediction intervals. Default is None.dict
: y_tilde: Reconciliated predictions.sample
intervals_method
selected during the reconcilerโs instantiation. Currently available: normality
, bootstrap
, permbu
.
Args:
num_samples
(int): number of samples generated from coherent distribution.np.ndarray
: samples: Coherent samples of size (num_series
, horizon
, num_samples
).BottomUpSparse
fit
S
(np.ndarray): Summing matrix of size (base
, bottom
).y_hat
(np.ndarray): Forecast values of size (base
, horizon
).idx_bottom
(np.ndarray): Indices corresponding to the bottom level of S
, size (bottom
).y_insample
(Optional[np.ndarray], optional): In-sample values of size (base
, horizon
). Default is None.y_hat_insample
(Optional[np.ndarray], optional): In-sample forecast values of size (base
, horizon
). Default is None.sigmah
(Optional[np.ndarray], optional): Estimated standard deviation of the conditional marginal distribution. Default is None.intervals_method
(Optional[str], optional): Sampler for prediction intervals, one of normality
, bootstrap
, permbu
. Default is None.num_samples
(Optional[int], optional): Number of samples for probabilistic coherent distribution. Default is None.seed
(Optional[int], optional): Seed for reproducibility. Default is None.tags
(Optional[dict[str, np.ndarray]], optional): Tags for hierarchical structure. Default is None.BottomUp
: object, fitted reconciler.fit_predict
S
(np.ndarray): Summing matrix of size (base
, bottom
).y_hat
(np.ndarray): Forecast values of size (base
, horizon
).idx_bottom
(np.ndarray): Indices corresponding to the bottom level of S
, size (bottom
).y_insample
(Optional[np.ndarray], optional): In-sample values of size (base
, insample_size
). Default is None.y_hat_insample
(Optional[np.ndarray], optional): In-sample forecast values of size (base
, insample_size
). Default is None.sigmah
(Optional[np.ndarray], optional): Estimated standard deviation of the conditional marginal distribution. Default is None.level
(Optional[list[int]], optional): float list 0-100, confidence levels for prediction intervals. Default is None.intervals_method
(Optional[str], optional): Sampler for prediction intervals, one of normality
, bootstrap
, permbu
. Default is None.num_samples
(Optional[int], optional): Number of samples for probabilistic coherent distribution. Default is None.seed
(Optional[int], optional): Seed for reproducibility. Default is None.tags
(Optional[dict[str, np.ndarray]], optional): Tags for hierarchical structure. Default is None.dict
: y_tilde: Reconciliated y_hat using the Bottom Up approach.predict
S
(np.ndarray): Summing matrix of size (base
, bottom
).y_hat
(np.ndarray): Forecast values of size (base
, horizon
).level
(Optional[list[int]], optional): float list 0-100, confidence levels for prediction intervals. Default is None.dict
: y_tilde: Reconciliated predictions.sample
intervals_method
selected during the reconcilerโs instantiation. Currently available: normality
, bootstrap
, permbu
.
Args:
num_samples
(int): number of samples generated from coherent distribution.np.ndarray
: samples: Coherent samples of size (num_series
, horizon
, num_samples
).TopDown
method
: One of forecast_proportions
, average_proportions
and proportion_averages
.doi
: 10.1002/for.3980090304](https://onlinelibrary.wiley.com/doi/abs/10.1002/for.3980090304).
doi
: 10.1016/S0305-0548(99)00017-9](https://doi.org/10.1016/S0305-0548(99)00017-9).__init__
fit
S
: Summing matrix of size (base
, bottom
).y_hat
: Forecast values of size (base
, horizon
).y_insample
: Insample values of size (base
, insample_size
). Optional for forecast_proportions
method.y_hat_insample
: Insample forecast values of size (base
, insample_size
). Optional for forecast_proportions
method.sigmah
: Estimated standard deviation of the conditional marginal distribution.interval_method
: Sampler for prediction intervals, one of normality
, bootstrap
, permbu
.num_samples
: Number of samples for probabilistic coherent distribution.seed
: Seed for reproducibility.tags
: Each key is a level and each value its S
indices.idx_bottom
: Indices corresponding to the bottom level of S
, size (bottom
).self
: object, fitted reconciler.fit_predict
S
: Summing matrix of size (base
, bottom
).y_hat
: Forecast values of size (base
, horizon
).tags
: Each key is a level and each value its S
indices.idx_bottom
: Indices corresponding to the bottom level of S
, size (bottom
).y_insample
: Insample values of size (base
, insample_size
). Optional for forecast_proportions
method.y_hat_insample
: Insample forecast values of size (base
, insample_size
). Optional for forecast_proportions
method.sigmah
: Estimated standard deviation of the conditional marginal distribution.level
: float list 0-100, confidence levels for prediction intervals.intervals_method
: Sampler for prediction intervals, one of normality
, bootstrap
, permbu
.num_samples
: Number of samples for probabilistic coherent distribution.seed
: Seed for reproducibility.y_tilde
: Reconciliated y_hat using the Top Down approach.predict
S
(np.ndarray): Summing matrix of size (base
, bottom
).y_hat
(np.ndarray): Forecast values of size (base
, horizon
).level
(Optional[list[int]], optional): float list 0-100, confidence levels for prediction intervals. Default is None.dict
: y_tilde: Reconciliated predictions.sample
intervals_method
selected during the reconcilerโs instantiation. Currently available: normality
, bootstrap
, permbu
.
Args:
num_samples
(int): number of samples generated from coherent distribution.np.ndarray
: samples: Coherent samples of size (num_series
, horizon
, num_samples
).TopDownSparse
__init__
fit
S
: Summing matrix of size (base
, bottom
).y_hat
: Forecast values of size (base
, horizon
).y_insample
: Insample values of size (base
, insample_size
). Optional for forecast_proportions
method.y_hat_insample
: Insample forecast values of size (base
, insample_size
). Optional for forecast_proportions
method.sigmah
: Estimated standard deviation of the conditional marginal distribution.interval_method
: Sampler for prediction intervals, one of normality
, bootstrap
, permbu
.num_samples
: Number of samples for probabilistic coherent distribution.seed
: Seed for reproducibility.tags
: Each key is a level and each value its S
indices.idx_bottom
: Indices corresponding to the bottom level of S
, size (bottom
).self
: object, fitted reconciler.fit_predict
predict
S
(np.ndarray): Summing matrix of size (base
, bottom
).y_hat
(np.ndarray): Forecast values of size (base
, horizon
).level
(Optional[list[int]], optional): float list 0-100, confidence levels for prediction intervals. Default is None.dict
: y_tilde: Reconciliated predictions.sample
intervals_method
selected during the reconcilerโs instantiation. Currently available: normality
, bootstrap
, permbu
.
Args:
num_samples
(int): number of samples generated from coherent distribution.np.ndarray
: samples: Coherent samples of size (num_series
, horizon
, num_samples
).MiddleOut
middle_level
: Middle level.top_down_method
: One of forecast_proportions
, average_proportions
and proportion_averages
.Chapter 11
: Forecasting hierarchical and grouped series.โ. OTexts: Melbourne, Australia. OTexts.com/fpp3Accessed on July 2022.](https
: //otexts.com/fpp3/hierarchical.html)__init__
fit
fit_predict
S
: Summing matrix of size (base
, bottom
).y_hat
: Forecast values of size (base
, horizon
).tags
: Each key is a level and each value its S
indices.y_insample
: Insample values of size (base
, insample_size
). Only used for forecast_proportions
y_hat_insample
: In-sample forecast values of size (base
, insample_size
).sigmah
: Estimated standard deviation of the conditional marginal distribution.level
: float list 0-100, confidence levels for prediction intervals.intervals_method
: Sampler for prediction intervals, one of normality
, bootstrap
, permbu
.num_samples
: Number of samples for probabilistic coherent distribution.seed
: Seed for reproducibility.y_tilde
: Reconciliated y_hat using the Middle Out approach.predict
sample
intervals_method
selected during the reconcilerโs instantiation. Currently available: normality
, bootstrap
, permbu
.
Args:
num_samples
(int): number of samples generated from coherent distribution.np.ndarray
: samples: Coherent samples of size (num_series
, horizon
, num_samples
).MiddleOutSparse
__init__
fit
fit_predict
predict
sample
intervals_method
selected during the reconcilerโs instantiation. Currently available: normality
, bootstrap
, permbu
.
Args:
num_samples
(int): number of samples generated from coherent distribution.np.ndarray
: samples: Coherent samples of size (num_series
, horizon
, num_samples
).MinTrace
method
: str, one of ols
, wls_struct
, wls_var
, mint_shrink
, mint_cov
.nonnegative
: bool, reconciled forecasts should be nonnegative?mint_shr_ridge
: float=2e-8, ridge numeric protection to MinTrace-shr covariance estimator.num_threads
: int=1, number of threads to use for solving the optimization problems (when nonnegative=True).114 , 804โ819. doi
: 10.1080/01621459.2018.1448825.](https://robjhyndman.com/publications/mint/).
https
: //doi.org/10.1007/s11222-020-09930-0](https://robjhyndman.com/publications/nnmint/).__init__
fit
S
: Summing matrix of size (base
, bottom
).y_hat
: Forecast values of size (base
, horizon
).y_insample
: Insample values of size (base
, insample_size
). Only used with โwls_varโ, โmint_covโ, โmint_shrinkโ.y_hat_insample
: Insample forecast values of size (base
, insample_size
). Only used with โwls_varโ, โmint_covโ, โmint_shrinkโsigmah
: Estimated standard deviation of the conditional marginal distribution.intervals_method
: Sampler for prediction intervals, one of normality
, bootstrap
, permbu
.num_samples
: Number of samples for probabilistic coherent distribution.seed
: Seed for reproducibility.tags
: Each key is a level and each value its S
indices.idx_bottom
: Indices corresponding to the bottom level of S
, size (bottom
).self
: object, fitted reconciler.fit_predict
S
: Summing matrix of size (base
, bottom
).y_hat
: Forecast values of size (base
, horizon
).idx_bottom
: Indices corresponding to the bottom level of S
, size (bottom
).y_insample
: Insample values of size (base
, insample_size
). Only used by wls_var
, mint_cov
, mint_shrink
y_hat_insample
: Insample fitted values of size (base
, insample_size
). Only used by wls_var
, mint_cov
, mint_shrink
sigmah
: Estimated standard deviation of the conditional marginal distribution.level
: float list 0-100, confidence levels for prediction intervals.intervals_method
: Sampler for prediction intervals, one of normality
, bootstrap
, permbu
.num_samples
: Number of samples for probabilistic coherent distribution.seed
: Seed for reproducibility.tags
: Each key is a level and each value its S
indices.y_tilde
: Reconciliated y_hat using the MinTrace approach.predict
S
(np.ndarray): Summing matrix of size (base
, bottom
).y_hat
(np.ndarray): Forecast values of size (base
, horizon
).level
(Optional[list[int]], optional): float list 0-100, confidence levels for prediction intervals. Default is None.dict
: y_tilde: Reconciliated predictions.sample
intervals_method
selected during the reconcilerโs instantiation. Currently available: normality
, bootstrap
, permbu
.
Args:
num_samples
(int): number of samples generated from coherent distribution.np.ndarray
: samples: Coherent samples of size (num_series
, horizon
, num_samples
).MinTraceSparse
method
: str, one of ols
, wls_struct
, or wls_var
.nonnegative
: bool, return non-negative reconciled forecasts.num_threads
: int, number of threads to execute non-negative quadratic programming calls.qp
: bool, implement non-negativity constraint with a quadratic programming approach. Setting this to True generally gives better results, but at the expense of higher cost to compute. __init__
fit
S
: Summing matrix of size (base
, bottom
).y_hat
: Forecast values of size (base
, horizon
).y_insample
: Insample values of size (base
, insample_size
). Only used with โwls_varโ.y_hat_insample
: Insample forecast values of size (base
, insample_size
). Only used with โwls_varโsigmah
: Estimated standard deviation of the conditional marginal distribution.intervals_method
: Sampler for prediction intervals, one of normality
, bootstrap
, permbu
.num_samples
: Number of samples for probabilistic coherent distribution.seed
: Seed for reproducibility.tags
: Each key is a level and each value its S
indices.idx_bottom
: Indices corresponding to the bottom level of S
, size (bottom
).self
: object, fitted reconciler.fit_predict
S
: Summing matrix of size (base
, bottom
).y_hat
: Forecast values of size (base
, horizon
).idx_bottom
: Indices corresponding to the bottom level of S
, size (bottom
).y_insample
: Insample values of size (base
, insample_size
). Only used by wls_var
, mint_cov
, mint_shrink
y_hat_insample
: Insample fitted values of size (base
, insample_size
). Only used by wls_var
, mint_cov
, mint_shrink
sigmah
: Estimated standard deviation of the conditional marginal distribution.level
: float list 0-100, confidence levels for prediction intervals.intervals_method
: Sampler for prediction intervals, one of normality
, bootstrap
, permbu
.num_samples
: Number of samples for probabilistic coherent distribution.seed
: Seed for reproducibility.tags
: Each key is a level and each value its S
indices.y_tilde
: Reconciliated y_hat using the MinTrace approach.predict
S
(np.ndarray): Summing matrix of size (base
, bottom
).y_hat
(np.ndarray): Forecast values of size (base
, horizon
).level
(Optional[list[int]], optional): float list 0-100, confidence levels for prediction intervals. Default is None.dict
: y_tilde: Reconciliated predictions.sample
intervals_method
selected during the reconcilerโs instantiation. Currently available: normality
, bootstrap
, permbu
.
Args:
num_samples
(int): number of samples generated from coherent distribution.np.ndarray
: samples: Coherent samples of size (num_series
, horizon
, num_samples
).OptimalCombination
MinTrace
variants.
Args:
method
: str, allowed optimal combination methods: โolsโ, โwls_structโ.nonnegative
: bool, reconciled forecasts should be nonnegative?Hierarchical Time Series".](https
: //robjhyndman.com/papers/Hierarchical6.pdf).
Hierarchical Time Series".](https
: //robjhyndman.com/papers/MinT.pdf).
https
: //doi.org/10.1007/s11222-020-09930-0](https://robjhyndman.com/publications/nnmint/).__init__
fit
S
: Summing matrix of size (base
, bottom
).y_hat
: Forecast values of size (base
, horizon
).y_insample
: Insample values of size (base
, insample_size
). Only used with โwls_varโ, โmint_covโ, โmint_shrinkโ.y_hat_insample
: Insample forecast values of size (base
, insample_size
). Only used with โwls_varโ, โmint_covโ, โmint_shrinkโsigmah
: Estimated standard deviation of the conditional marginal distribution.intervals_method
: Sampler for prediction intervals, one of normality
, bootstrap
, permbu
.num_samples
: Number of samples for probabilistic coherent distribution.seed
: Seed for reproducibility.tags
: Each key is a level and each value its S
indices.idx_bottom
: Indices corresponding to the bottom level of S
, size (bottom
).self
: object, fitted reconciler.fit_predict
S
: Summing matrix of size (base
, bottom
).y_hat
: Forecast values of size (base
, horizon
).idx_bottom
: Indices corresponding to the bottom level of S
, size (bottom
).y_insample
: Insample values of size (base
, insample_size
). Only used by wls_var
, mint_cov
, mint_shrink
y_hat_insample
: Insample fitted values of size (base
, insample_size
). Only used by wls_var
, mint_cov
, mint_shrink
sigmah
: Estimated standard deviation of the conditional marginal distribution.level
: float list 0-100, confidence levels for prediction intervals.intervals_method
: Sampler for prediction intervals, one of normality
, bootstrap
, permbu
.num_samples
: Number of samples for probabilistic coherent distribution.seed
: Seed for reproducibility.tags
: Each key is a level and each value its S
indices.y_tilde
: Reconciliated y_hat using the MinTrace approach.predict
S
(np.ndarray): Summing matrix of size (base
, bottom
).y_hat
(np.ndarray): Forecast values of size (base
, horizon
).level
(Optional[list[int]], optional): float list 0-100, confidence levels for prediction intervals. Default is None.dict
: y_tilde: Reconciliated predictions.sample
intervals_method
selected during the reconcilerโs instantiation. Currently available: normality
, bootstrap
, permbu
.
Args:
num_samples
(int): number of samples generated from coherent distribution.np.ndarray
: samples: Coherent samples of size (num_series
, horizon
, num_samples
).ERM
method='closed'
) follows the expression:
The alternative Lasso regularized solution (method='reg_bu'
) is useful when the observations of validation data is limited or the exact solution has low numerical stability.
Args:
method
: str, one of closed
, reg
and reg_bu
.lambda_reg
: float, l1 regularizer for reg
and reg_bu
.Discovery & Data Mining KDD โ19 (p. 1337-1347). New York, NY, USA
: Association for Computing Machinery.](https://doi.org/10.1145/3292500.3330976).__init__
fit
S
: Summing matrix of size (base
, bottom
).y_hat
: Forecast values of size (base
, horizon
).y_insample
: Train values of size (base
, insample_size
).y_hat_insample
: Insample train predictions of size (base
, insample_size
).sigmah
: Estimated standard deviation of the conditional marginal distribution.intervals_method
: Sampler for prediction intervals, one of normality
, bootstrap
, permbu
.num_samples
: Number of samples for probabilistic coherent distribution.seed
: Seed for reproducibility.tags
: Each key is a level and each value its S
indices.idx_bottom
: Indices corresponding to the bottom level of S
, size (bottom
).self
: object, fitted reconciler.fit_predict
S
: Summing matrix of size (base
, bottom
).y_hat
: Forecast values of size (base
, horizon
).idx_bottom
: Indices corresponding to the bottom level of S
, size (bottom
).y_insample
: Train values of size (base
, insample_size
).y_hat_insample
: Insample train predictions of size (base
, insample_size
).sigmah
: Estimated standard deviation of the conditional marginal distribution.level
: float list 0-100, confidence levels for prediction intervals.intervals_method
: Sampler for prediction intervals, one of normality
, bootstrap
, permbu
.num_samples
: Number of samples for probabilistic coherent distribution.seed
: Seed for reproducibility.tags
: Each key is a level and each value its S
indices.y_tilde
: Reconciliated y_hat using the ERM approach.predict
S
(np.ndarray): Summing matrix of size (base
, bottom
).y_hat
(np.ndarray): Forecast values of size (base
, horizon
).level
(Optional[list[int]], optional): float list 0-100, confidence levels for prediction intervals. Default is None.dict
: y_tilde: Reconciliated predictions.sample
intervals_method
selected during the reconcilerโs instantiation. Currently available: normality
, bootstrap
, permbu
.
Args:
num_samples
(int): number of samples generated from coherent distribution.np.ndarray
: samples: Coherent samples of size (num_series
, horizon
, num_samples
).