Back to models
Forecaster

Permute

Permutation compositor for permuting forecasting pipeline steps.

Quickstart

python
from sktime.forecasting.compose import Permute

estimator = Permute(estimator, permutation=None, steps_arg='steps')

Parameters(3)

estimatorsktime forecaster, inheriting from BaseForecaster

must have parameter with name steps_arg estimator whose steps are being permuted

permutationlist of str, or None, optional, default = None
if not None, must be equal length as getattr(estimator, steps_arg) and elements must be equal to names of estimator.steps_arg estimators names are unique names as created by _get_estimator_tuples (if unnamed list), or first string element of tuples, of estimator.steps_arg list is interpreted as range of permutation of names if None, is interpreted as the identity permutation
steps_argstring, optional, default=”steps”
name of the steps parameter. getattr(estimator, steps_arg) must be list of estimators, or list of (str, estimator) pairs

Examples

>>> from sktime.datasets import load_airline
>>> from sktime.forecasting.base import ForecastingHorizon
>>> from sktime.forecasting.compose import ForecastingPipeline, Permute
>>> from sktime.forecasting.naive import NaiveForecaster
>>> from sktime.transformations.boxcox import BoxCoxTransformer
>>> from sktime.transformations.exponent import ExponentTransformer Simple example: permute sequence of estimator in forecasting pipeline
>>> y = load_airline ()
>>> fh = ForecastingHorizon ([1, 2, 3 ])
>>> pipe = ForecastingPipeline (
... [
... ("boxcox", BoxCoxTransformer ()),
... ("exp", ExponentTransformer (3)),
... ("naive", NaiveForecaster ()),
... ]
... )
>>> # this results in the pipeline with sequence "exp", "boxcox", "naive"
>>> permuted = Permute (pipe, ["exp", "boxcox", "naive" ])
>>> permuted = permuted. fit (y, fh = fh)
>>> y_pred = permuted. predict () The permuter is useful in combination with grid search (toy example):
>>> from sktime.datasets import load_shampoo_sales
>>> from sktime.forecasting.model_selection import ForecastingGridSearchCV
>>> from sktime.split import ExpandingWindowSplitter
>>> fh = [1, 2, 3 ]
>>> cv = ExpandingWindowSplitter (fh = fh)
>>> forecaster = NaiveForecaster ()
>>> # check which of the two sequences of transformers is better
>>> param_grid = {
... "permutation": [["boxcox", "exp", "naive" ], ["exp", "boxcox", "naive" ]]
... }
>>> gscv = ForecastingGridSearchCV (
... forecaster = permuted,
... param_grid = param_grid,
... cv = cv)