Back to models
Transformer

TransformerPipeline

Pipeline of transformers compositor.

Quickstart

python
from sktime.transformations.compose import TransformerPipeline

estimator = TransformerPipeline(steps)

Parameters(1)

stepslist of sktime transformers, or

list of tuples (str, transformer) of sktime transformers these are “blueprint” transformers, states do not change when fit is called

Examples

>>> from sktime.transformations.compose import TransformerPipeline
>>> from sktime.transformations.exponent import ExponentTransformer
>>> t1 = ExponentTransformer (power = 2)
>>> t2 = ExponentTransformer (power = 0.5) Example 1, option A: construct without strings (unique names are generated for the two components t1 and t2)
>>> pipe = TransformerPipeline (steps = [t1, t2 ]) Example 1, option B: construct with strings to give custom names to steps
>>> pipe = TransformerPipeline (
... steps = [
... ("trafo1", t1),
... ("trafo2", t2),
... ]
... ) Example 1, option C: for quick construction, the * dunder method can be used
>>> pipe = t1 * t2 Example 2: sklearn transformers can be used in the pipeline. If applied to Series, sklearn transformers are applied by series instance. If applied to Table, sklearn transformers are applied to the table as a whole.
>>> from sklearn.preprocessing import StandardScaler
>>> from sktime.transformations.summarize import SummaryTransformer This applies the scaler per series, then summarizes:
>>> pipe = StandardScaler () * SummaryTransformer () This applies the sumamrization, then scales the full summary table:
>>> pipe = SummaryTransformer () * StandardScaler () This scales the series, then summarizes, then scales the full summary table:
>>> pipe = StandardScaler () * SummaryTransformer () * StandardScaler ()