HierarchicalPipeline

class HierarchicalPipeline(reconciliator: etna.reconciliation.base.BaseReconciliator, model: Union[etna.models.base.NonPredictionIntervalContextIgnorantAbstractModel, etna.models.base.NonPredictionIntervalContextRequiredAbstractModel, etna.models.base.PredictionIntervalContextIgnorantAbstractModel, etna.models.base.PredictionIntervalContextRequiredAbstractModel], transforms: Sequence[etna.transforms.base.Transform] = (), horizon: int = 1)[source]

Bases: etna.pipeline.pipeline.Pipeline

Pipeline of transforms with a final estimator for hierarchical time series data.

Create instance of HierarchicalPipeline with given parameters.

Parameters

Warning

Estimation of forecast intervals with forecast(prediction_interval=True) method and BottomUpReconciliator may be not reliable.

Inherited-members

Parameters

Methods

backtest(ts, metrics[, n_folds, mode, ...])

Run backtest with the pipeline.

fit(ts)

Fit the HierarchicalPipeline.

forecast([prediction_interval, quantiles, ...])

Make a prediction for target at the source level of hierarchy and make reconciliation to target level.

load(path[, ts])

Load an object.

predict(ts[, start_timestamp, ...])

Make in-sample predictions on dataset in a given range.

raw_forecast([prediction_interval, ...])

Make a prediction for target at the source level of hierarchy.

save(path)

Save the object.

to_dict()

Collect all information about etna object in dict.

Attributes

fit(ts: etna.datasets.tsdataset.TSDataset) etna.pipeline.hierarchical_pipeline.HierarchicalPipeline[source]

Fit the HierarchicalPipeline.

Fit and apply given transforms to the data, then fit the model on the transformed data. Provided hierarchical dataset will be aggregated to the source level before fitting pipeline.

Parameters

ts (etna.datasets.tsdataset.TSDataset) – Dataset with hierarchical timeseries data

Returns

Fitted HierarchicalPipeline instance

Return type

etna.pipeline.hierarchical_pipeline.HierarchicalPipeline

forecast(prediction_interval: bool = False, quantiles: Sequence[float] = (0.025, 0.975), n_folds: int = 3) etna.datasets.tsdataset.TSDataset[source]

Make a prediction for target at the source level of hierarchy and make reconciliation to target level.

Parameters
  • prediction_interval (bool) – If True returns prediction interval for forecast

  • quantiles (Sequence[float]) – Levels of prediction distribution. By default 2.5% and 97.5% taken to form a 95% prediction interval

  • n_folds (int) – Number of folds to use in the backtest for prediction interval estimation

Returns

Dataset with predictions at the target level of hierarchy.

Return type

etna.datasets.tsdataset.TSDataset

raw_forecast(prediction_interval: bool = False, quantiles: Sequence[float] = (0.25, 0.75), n_folds: int = 3) etna.datasets.tsdataset.TSDataset[source]

Make a prediction for target at the source level of hierarchy.

Parameters
  • prediction_interval (bool) – If True returns prediction interval for forecast

  • quantiles (Sequence[float]) – Levels of prediction distribution. By default 2.5% and 97.5% taken to form a 95% prediction interval

  • n_folds (int) – Number of folds to use in the backtest for prediction interval estimation

Returns

Dataset with predictions at the source level

Return type

etna.datasets.tsdataset.TSDataset