RandomShapeletTransform
Random Shapelet Transform.
Implementation of the binary shapelet transform along the lines of [R23aa2a61a9f8-1]_[R23aa2a61a9f8-2]_, with randomly extracted shapelets.
Overview: Input “n” series with “d” dimensions of length “m”. Continuously extract candidate shapelets and filter them in batches. For each candidate shapelet
- Extract a shapelet from an instance with random length, position and
dimension
- Using its distance to train cases, calculate the shapelets information
gain
- Abandon evaluating the shapelet if it is impossible to obtain a higher
information gain than the current worst
For each shapelet batch
- Add each candidate to its classes shapelet heap, removing the lowest
information gain shapelet if the max number of shapelets has been met
Remove self-similar shapelets from the heap
Using the final set of filtered shapelets, transform the data into a vector of of distances from a series to each shapelet.
Schnellstart
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)Parameter(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.
Beispiele
>>> 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)Referenzen
Jon Hills et al., “Classification of time series by shapelet transformation”, Data Mining and Knowledge Discovery, 28(4), 851–881, 2014.
A. Bostrom and A. Bagnall, “Binary Shapelet Transform for Multiclass Time Series Classification”, Transactions on Large-Scale Data and Knowledge Centered Systems, 32, 2017.