Classifier
ClassifierPipeline
Pipeline of transformers and a classifier.
Quickstart
python
from sktime.classification.compose import ClassifierPipeline
estimator = ClassifierPipeline(classifier, transformers)Parameters(2)
- classifiersktime classifier, i.e., estimator inheriting from BaseClassifier
this is a “blueprint” classifier, state does not change when
fitis called- transformerslist of sktime transformers, or
list of tuples (str, transformer) of sktime transformers these are “blueprint” transformers, states do not change when
fitis called
Examples
>>> from sktime.transformations.pca import PCATransformer
>>> from sktime.classification.interval_based import TimeSeriesForestClassifier
>>> from sktime.datasets import load_unit_test
>>> from sktime.classification.compose import ClassifierPipeline
>>> X_train, y_train = load_unit_test (split = "train")
>>> X_test, y_test = load_unit_test (split = "test")
>>> pipeline = ClassifierPipeline (
... TimeSeriesForestClassifier (n_estimators = 5), [PCATransformer ()]
... )
>>> pipeline. fit (X_train, y_train) ClassifierPipeline(
... )
>>> y_pred = pipeline. predict (X_test) Alternative construction via dunder method:
>>> pipeline = PCATransformer () * TimeSeriesForestClassifier (n_estimators = 5)