assemble_pipelines

assemble_pipelines(models: Union[etna.models.base.PerSegmentModel, etna.models.base.PerSegmentPredictionIntervalModel, etna.models.base.MultiSegmentModel, etna.models.base.DeepBaseModel, Sequence[Union[etna.models.base.PerSegmentModel, etna.models.base.PerSegmentPredictionIntervalModel, etna.models.base.MultiSegmentModel, etna.models.base.DeepBaseModel]]], transforms: Sequence[Union[etna.transforms.base.Transform, Sequence[Optional[etna.transforms.base.Transform]]]], horizons: Union[int, Sequence[int]]) List[etna.pipeline.pipeline.Pipeline][source]

Create pipelines with broadcasting from models, transforms and horizons.

After broadcasting we have:

  • models:

\[M_1, \dots, M_n\]
  • transforms:

\[(T_{1,1}, \dots, T_{1,n}), ... (T_{k,1}, \dots, T_{k,n})\]
  • horizons:

\[H_1, \dots, H_n\]

We expect that in input shape of size n can be reduced to size 1 or even become a scalar value. During broadcasting we copy this value n times.

Parameters
Returns

list of pipelines

Raises

ValueError: – If the length of models sequence not equals to length of horizons sequence.

Return type

List[etna.pipeline.pipeline.Pipeline]

Examples

>>> from etna.pipeline import assemble_pipelines
>>> from etna.models import LinearPerSegmentModel, NaiveModel
>>> from etna.transforms import TrendTransform, AddConstTransform, LagTransform
>>> assemble_pipelines(models=LinearPerSegmentModel(), transforms=[LagTransform(in_column='target', lags=[1]), AddConstTransform(in_column='target', value=1)], horizons=[1,2,3])
[Pipeline(model = LinearPerSegmentModel(fit_intercept = True, ), transforms = [LagTransform(in_column = 'target', lags = [1], out_column = None, ), AddConstTransform(in_column = 'target', value = 1, inplace = True, out_column = None, )], horizon = 1, ),
Pipeline(model = LinearPerSegmentModel(fit_intercept = True, ), transforms = [LagTransform(in_column = 'target', lags = [1], out_column = None, ), AddConstTransform(in_column = 'target', value = 1, inplace = True, out_column = None, )], horizon = 2, ),
Pipeline(model = LinearPerSegmentModel(fit_intercept = True, ), transforms = [LagTransform(in_column = 'target', lags = [1], out_column = None, ), AddConstTransform(in_column = 'target', value = 1, inplace = True, out_column = None, )], horizon = 3, )]
>>> assemble_pipelines(models=[LinearPerSegmentModel(), NaiveModel()], transforms=[LagTransform(in_column='target', lags=[1]), [AddConstTransform(in_column='target', value=1), TrendTransform(in_column='target')]], horizons=[1,2])
[Pipeline(model = LinearPerSegmentModel(fit_intercept = True, ), transforms = [LagTransform(in_column = 'target', lags = [1], out_column = None, ), AddConstTransform(in_column = 'target', value = 1, inplace = True, out_column = None, )], horizon = 1, ),
Pipeline(model = NaiveModel(lag = 1, ), transforms = [LagTransform(in_column = 'target', lags = [1], out_column = None, ), TrendTransform(in_column = 'target', out_column = None, detrend_model = LinearRegression(), model = 'ar', custom_cost = None, min_size = 2, jump = 1, n_bkps = 5, pen = None, epsilon = None, )], horizon = 2, )]