-
Notifications
You must be signed in to change notification settings - Fork 89
/
_make_pipeline.py
54 lines (44 loc) · 1.73 KB
/
_make_pipeline.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"""Pipeline making utility."""
__author__ = ["fkiraly"]
def make_pipeline(*steps):
"""Create a pipeline from estimators of any type.
Parameters
----------
steps : tuple of aeon estimators
in same order as used for pipeline construction
Returns
-------
pipe : aeon pipeline containing steps, in order
always a descendant of BaseObject, precise object determined by
equivalent to result of step[0] * step[1] * ... * step[-1]
Examples
--------
>>> from aeon.datasets import load_airline
>>> y = load_airline()
Example 1: forecaster pipeline
>>> from aeon.datasets import load_airline
>>> from aeon.forecasting.trend import PolynomialTrendForecaster
>>> from aeon.pipeline import make_pipeline
>>> from aeon.transformations.exponent import ExponentTransformer
>>> y = load_airline()
>>> pipe = make_pipeline(ExponentTransformer(), PolynomialTrendForecaster())
>>> type(pipe).__name__
'TransformedTargetForecaster'
Example 2: classifier pipeline
>>> from aeon.classification.feature_based import Catch22Classifier
>>> from aeon.pipeline import make_pipeline
>>> from aeon.transformations.exponent import ExponentTransformer
>>> pipe = make_pipeline(ExponentTransformer(), Catch22Classifier())
>>> type(pipe).__name__
'ClassifierPipeline'
Example 3: transformer pipeline
>>> from aeon.pipeline import make_pipeline
>>> from aeon.transformations.exponent import ExponentTransformer
>>> pipe = make_pipeline(ExponentTransformer(), ExponentTransformer())
>>> type(pipe).__name__
'TransformerPipeline'
"""
pipe = steps[0]
for i in range(1, len(steps)):
pipe = pipe * steps[i]
return pipe