Transformer
RandomShapeletTransform
Random Shapelet Transform.
Quickstart
python
from sktime.transformations.shapelet_transform import RandomShapeletTransform
estimator = RandomShapeletTransform(n_shapelet_samples=10000, max_shapelets=None, min_shapelet_length=3, max_shapelet_length=None, remove_self_similar=True, time_limit_in_minutes=0.0, contract_max_n_shapelet_samples=inf, n_jobs=1, parallel_backend=None, batch_size=100, random_state=None)Parameters(11)
- n_shapelet_samplesint, default=10000
- The number of candidate shapelets to be considered for the final transform. Filtered down to <= max_shapelets, keeping the shapelets with the most information gain.
- max_shapeletsint or None, default=None
- Max number of shapelets to keep for the final transform. Each class value will have its own max, set to n_classes / max_shapelets. If None uses the min between 10 * n_instances and 1000
- min_shapelet_lengthint, default=3
- Lower bound on candidate shapelet lengths.
- max_shapelet_lengthint or None, default= None
- Upper bound on candidate shapelet lengths. If None no max length is used.
- remove_self_similarboolean, default=True
- Remove overlapping “self-similar” shapelets when merging candidate shapelets.
- time_limit_in_minutesint, default=0
- Time contract to limit build time in minutes, overriding n_shapelet_samples. Default of 0 means n_shapelet_samples is used.
- contract_max_n_shapelet_samplesint, default=np.inf
- Max number of shapelets to extract when time_limit_in_minutes is set.
- n_jobsint, default=1
The number of jobs to run in parallel for both
fitandtransform.-1means using all processors.- parallel_backendstr, ParallelBackendBase instance or None, default=None
- Specify the parallelisation backend implementation in joblib, if None a ‘prefer’ value of “threads” is used by default. Valid options are “loky”, “multiprocessing”, “threading” or a custom backend. See the joblib Parallel documentation for more details.
- batch_sizeint or None, default=100
- Number of shapelet candidates processed before being merged into the set of best shapelets.
- random_stateint or None, default=None
- Seed for random number generation.
Examples
>>> from sktime.transformations.shapelet_transform import (
... RandomShapeletTransform
... )
>>> from sktime.datasets import load_unit_test
>>> X_train, y_train = load_unit_test (split = "train", return_X_y = True)
>>> t = RandomShapeletTransform (
... n_shapelet_samples = 500,
... max_shapelets = 10,
... batch_size = 100,
... )
>>> t. fit (X_train, y_train) RandomShapeletTransform(
... )
>>> X_t = t. transform (X_train)References
- [1 ] Jon Hills et al., “Classification of time series by shapelet transformation”, Data Mining and Knowledge Discovery, 28(4), 851–881, 2014. [2 ] A. Bostrom and A. Bagnall, “Binary Shapelet Transform for Multiclass Time Series Classification”, Transactions on Large-Scale Data and Knowledge Centered Systems, 32, 2017.