ShapeletLearningClassifierPyts
Learning Shapelets algorithm, from pyts.
Quickstart
from sktime.classification.shapelet_based import ShapeletLearningClassifierPyts
estimator = ShapeletLearningClassifierPyts(loss='softmax', n_shapelets_per_size=0.2, min_shapelet_length=0.1, shapelet_scale=3, penalty='l2', tol=0.001, C=1000, learning_rate=1.0, max_iter=1000, multi_class='multinomial', alpha=-100, fit_intercept=True, intercept_scaling=1.0, class_weight=None, n_jobs=None, verbose=0, random_state=None)Parameters(17)
- lossstr (default = ‘softmax’), “softmax” or “crossentropy”
Loss function to use. If “softmax”, the loss function is the softmax function (logistic loss). Dispatches to
LearningShapelets. If “crossentropy”, the loss function is the cross-entropy loss. Dispatches toLearningShapeletsCrossEntropy.- n_shapelets_per_sizeint or float (default = 0.2)
Number of shapelets per size. If float, it represents a fraction of the number of timestamps and the number of shapelets per size is equal to
ceil(n_shapelets_per_size * n_timestamps).- min_shapelet_lengthint or float (default = 0.1)
Minimum length of the shapelets. If float, it represents a fraction of the number of timestamps and the minimum length of the shapelets per size is equal to
ceil(min_shapelet_length * n_timestamps).- shapelet_scaleint (default = 3)
The different scales for the lengths of the shapelets. The lengths of the shapelets are equal to
min_shapelet_length * np.arange(1, shapelet_scale + 1). The total number of shapelets (and features) is equal ton_shapelets_per_size * shapelet_scale.- penalty‘l1’ or ‘l2’ (default = ‘l2’)
- Used to specify the norm used in the penalization.
- tolfloat (default = 1e-3)
- Tolerance for stopping criterion.
- Cfloat (default = 1000)
- Inverse of regularization strength. It must be a positive float. Smaller values specify stronger regularization.
- learning_ratefloat (default = 1.)
- Learning rate for gradient descent optimization. It must be a positive float. Note that the learning rate will be automatically decreased if the loss function is not decreasing.
- max_iterint (default = 1000)
- Maximum number of iterations for gradient descent algorithm.
- multi_class{‘multinomial’, ‘ovr’, ‘ovo’} (default = ‘multinomial’)
Strategy for multiclass classification. Only used if
loss="softmax". The options are as follows: ‘multinomial’ stands for multinomial cross-entropy loss. ‘ovr’ stands for one-vs-rest strategy. ‘ovo’ stands for one-vs-one strategy. Ignored if the classification task is binary.- alphafloat (default = -100)
- Scaling term in the softmin function. The lower, the more precised the soft minimum will be. Default value should be good for standardized time series.
- fit_interceptbool (default = True)
- Specifies if a constant (a.k.a. bias or intercept) should be added to the decision function.
- intercept_scalingfloat (default = 1.)
Scaling of the intercept. Only used if
fit_intercept=True.- class_weightdict, None or ‘balanced’ (default = None)
Weights associated with classes in the form
{class_label: weight}. If not given, all classes are supposed to have unit weight. The “balanced” mode uses the values of y to automatically adjust weights inversely proportional to class frequencies in the input data asn_samples / (n_classes * np.bincount(y)).- n_jobsNone or int (default = None)
The number of jobs to use for the computation. Only used if
loss="softmax"andmulti_classis “ovr” or “ovo”.- verboseint (default = 0)
- Controls the verbosity. It must be a non-negative integer. If positive, loss at each iteration is printed.
- random_stateNone, int or RandomState instance (default = None)
- The seed of the pseudo random number generator to use when shuffling the data. If int, random_state is the seed used by the random number generator. If RandomState instance, random_state is the random number generator. If None, the random number generator is the RandomState instance used by np.random.
References
- [1 ] J. Grabocka, N. Schilling, M. Wistuba and L. Schmidt-Thieme, “Learning Time-Series Shapelets”. International Conference on Data Mining, 14, 392-401 (2014).