sktime.classification.shapelet_based¶
-
class
sktime.classification.shapelet_based.
MrSEQLClassifier
(seql_mode='fs', symrep='sax', custom_config=None)[source]¶ Bases:
sktime.classification.base.BaseClassifier
Time Series Classification with multiple symbolic representations and SEQL (Mr-SEQL)
@article{mrseql, author = {Le Nguyen, Thach and Gsponer, Severin and Ilie, Iulia and O’reilly, Martin and Ifrim, Georgiana}, title = {Interpretable Time Series Classification Using Linear Models and Multi-resolution Multi-domain Symbolic Representations}, journal = {Data Mining and Knowledge Discovery}, volume = {33}, number = {4}, year = {2019}, }
Overview: Mr-SEQL is a time series classifier that learn from multiple symbolic representations of multiple resolutions and multiple domains. Currently, Mr-SEQL supports both SAX and SFA representations.
- Parameters
seql_mode (str, either 'clf' or 'fs'. In the 'clf' mode, Mr-SEQL is an ensemble of SEQL models while in the 'fs' mode Mr-SEQL trains a logistic regression model with features extracted by SEQL from symbolic representations of time series.) –
symrep (list or tuple, should contains only 'sax' or 'sfa' or both. The symbolic representations to be used to transform the input time series.) –
custom_config (dict, customized parameters for the symbolic transformation. If defined, symrep will be ignored.) –
-
fit
(X, y)[source]¶ Fit the model according to the given training time series data. :param X: :type X: Time series data. :param y: :type y: Target vector relative to X.
- Returns
Fitted estimator.
- Return type
self
-
map_sax_model
(ts)[source]¶ For interpretation. Returns vectors of weights with the same length of the input time series. The weight of each point implies its contribution in the classification decision regarding the class.
- Parameters
ts (A single time series.) –
- Returns
weighted_ts
- Return type
ndarray of (number of classes, length of time series)
Note
Only supports univariate time series and SAX features.
-
predict
(X)[source]¶ Predict class labels for samples in X. :param X: :type X: time series data.
- Returns
C – Predicted class label per sample.
- Return type
array
-
predict_proba
(X)[source]¶ If seql_mode is set to ‘fs’, it returns the estimation by sklearn logistic regression model. Otherwise (seql_mode == ‘clf’), it returns normalized probability estimated with one-versus-all method.
- Parameters
X (time series data.) –
- Returns
T – Returns the probability of the sample for each class in the model, where classes are ordered as they are in
self.classes_
.- Return type
array-like of shape (n_samples, n_classes)
-
class
sktime.classification.shapelet_based.
ROCKETClassifier
(num_kernels=10000, ensemble=False, ensemble_size=25, random_state=None)[source]¶ Bases:
sktime.classification.base.BaseClassifier
Classifier wrapped for the ROCKET transformer using RidgeClassifierCV as the base classifier. Allows the creation of an ensemble of ROCKET classifiers to allow for generation of probabilities as the expense of scalability.
- Parameters
Notes
- @article{dempster_etal_2019,
author = {Dempster, Angus and Petitjean, Francois and Webb, Geoffrey I}, title = {ROCKET: Exceptionally fast and accurate time series classification using random convolutional kernels}, year = {2019}, journal = {arXiv:1910.13051}
}
Java version https://github.com/uea-machine-learning/tsml/blob/master/src/main/java/ tsml/classifiers/hybrids/ROCKETClassifier.java
-
fit
(X, y)[source]¶ Build a single or ensemble of pipelines containing the ROCKET transformer and RidgeClassifierCV classifier.
- Parameters
X (nested pandas DataFrame of shape [n_instances, 1]) – Nested dataframe with univariate time-series in cells.
y (array-like, shape = [n_instances] The class labels.) –
- Returns
self
- Return type
-
class
sktime.classification.shapelet_based.
ShapeletTransformClassifier
(time_contract_in_mins=300, n_estimators=500, random_state=None)[source]¶ Bases:
sktime.classification.base.BaseClassifier
- Shapelet Transform Classifier
Basic implementation along the lines of [1,2]
- Parameters
-
TO DO
Notes
..[1] Jon Hills et al., “Classification of time series by shapelet transformation”,
Data Mining and Knowledge Discovery, 28(4), 851–881, 2014
https://link.springer.com/article/10.1007/s10618-013-0322-1 ..[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
https://link.springer.com/chapter/10.1007/978-3-319-22729-0_20 Java Version https://github.com/uea-machine-learning/tsml/blob/master/src/main/ java/tsml/classifiers/shapelet_based/ShapeletTransformClassifier.java
-
fit
(X, y)[source]¶ Perform a shapelet transform then builds a random forest. Contract default for ST is 5 hours ———- X : array-like or sparse matrix of shape = [n_instances, series_length] or shape = [n_instances,n_columns]
The training input samples. If a Pandas data frame is passed it must have a single column (i.e. univariate classification. RISE has no bespoke method for multivariate classification as yet.
y : array-like, shape = [n_instances] The class labels.
- Returns
self
- Return type
-
predict
(X)[source]¶ Find predictions for all cases in X. Built on top of predict_proba :param X: :type X: array-like or sparse matrix of shape = [n_samps, num_atts] or a :param data frame.: :param If a Pandas data frame is passed: :param :
- Returns
output
- Return type
array of shape = [n_samples]
-
predict_proba
(X)[source]¶ Find probability estimates for each class for all cases in X. :param X: The training input samples. If a Pandas data frame is passed, :type X: array-like or sparse matrix of shape = [n_instances, n_columns]
- Returns
output
- Return type
array of shape = [n_samples, num_classes] of probabilities