Transformer
ClustererAsTransformer
Use a clusterer as a transformer.
This adapter is used in coercions, when passing a clusterer to a transformer slot.
The transformation is series-to-primitives, transforming a time series into its cluster assignment.
The adapter dispatches BaseTransformer.transform to BaseClusterer.predict, and requires a clusterer that is able to make cluster assignments via predict, see the capability:predict tag for clusterers.
Quickstart
python
from sktime.clustering.compose import ClustererAsTransformer
estimator = ClustererAsTransformer(clusterer)Tags
Capabilities
- Multivariate
- Missing values
- Removes missing values: Supported
- Unequal-length series
- Inverse transform: Not supported
- Equalizes series length: Not supported
Properties
- Input typescitype:transform-input
- Series
- Output typescitype:transform-output
- Primitives
- Label typescitype:transform-labels
- None
- Fit is emptyfit_is_empty
- No
- Keeps the time indextransform-returns-same-time-index
- Yes
- Requires Xrequires_X
- Yes
- Requires yrequires_y
- No
- X and y need the same indexX-y-must-have-same-index
- No
Parameters(1)
- clusterersktime clusterer, i.e., estimator inheriting from BaseClusterer
this is a “blueprint” clusterer, state does not change when
fitis called
Examples
>>> from sktime.clustering.compose import ClustererAsTransformer
>>> from sktime.clustering.dbscan import TimeSeriesDBSCAN
>>> from sktime.dists_kernels import AggrDist
>>> from sktime.datasets import load_unit_test
>>> X, _ = load_unit_test (split = "train")
>>> clusterer = TimeSeriesDBSCAN (AggrDist. create_test_instance ())
>>> cluster_assign_trafo = ClustererAsTransformer (clusterer)
>>> cluster_assign_trafo. fit (X) ClustererAsTransformer(
... )
>>> cluster_assignment = cluster_assign_trafo. transform (X)