Pipeline¶
- class Pipeline(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.mixins.ModelPipelinePredictMixin
,etna.pipeline.mixins.ModelPipelineParamsToTuneMixin
,etna.pipeline.mixins.SaveModelPipelineMixin
,etna.pipeline.base.BasePipeline
Pipeline of transforms with a final estimator.
Create instance of Pipeline with given parameters.
- Parameters
model (Union[etna.models.base.NonPredictionIntervalContextIgnorantAbstractModel, etna.models.base.NonPredictionIntervalContextRequiredAbstractModel, etna.models.base.PredictionIntervalContextIgnorantAbstractModel, etna.models.base.PredictionIntervalContextRequiredAbstractModel]) – Instance of the etna Model
transforms (Sequence[etna.transforms.base.Transform]) – Sequence of the transforms
horizon (int) – Number of timestamps in the future for forecasting
- Inherited-members
Methods
backtest
(ts, metrics[, n_folds, mode, ...])Run backtest with the pipeline.
fit
(ts)Fit the Pipeline.
forecast
([ts, prediction_interval, ...])Make a forecast of the next points of a dataset.
load
(path[, ts])Load an object.
params_to_tune
()Get hyperparameter grid to tune.
predict
(ts[, start_timestamp, ...])Make in-sample predictions on dataset in a given range.
save
(path)Save the object.
set_params
(**params)Return new object instance with modified parameters.
to_dict
()Collect all information about etna object in dict.
Attributes
- fit(ts: etna.datasets.tsdataset.TSDataset) etna.pipeline.pipeline.Pipeline [source]¶
Fit the Pipeline.
Fit and apply given transforms to the data, then fit the model on the transformed data.
- Parameters
ts (etna.datasets.tsdataset.TSDataset) – Dataset with timeseries data
- Returns
Fitted Pipeline instance
- Return type
- forecast(ts: Optional[etna.datasets.tsdataset.TSDataset] = None, prediction_interval: bool = False, quantiles: Sequence[float] = (0.025, 0.975), n_folds: int = 3, return_components: bool = False) etna.datasets.tsdataset.TSDataset [source]¶
Make a forecast of the next points of a dataset.
The result of forecasting starts from the last point of
ts
, not including it.- Parameters
ts (Optional[etna.datasets.tsdataset.TSDataset]) – Dataset to forecast. If not given, dataset given during :py:meth:
fit
is used.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
return_components (bool) – If True additionally returns forecast components
- Returns
Dataset with predictions
- Return type