pyrregular.models.svm

SVM Pipeline. Supports LCSS kernel and uses a custom TimeSeriesSVC class to handle the kernel.

Module Attributes

svm_pipeline

This pipeline applies standardize → convert_to_nested → drop_na → TimeSeriesSVC with LCSS kernel.

Classes

TimeSeriesSVCFix([kernel, kernel_params, ...])

class pyrregular.models.svm.TimeSeriesSVCFix(kernel=None, kernel_params=None, kernel_mtype=None, C=1, shrinking=True, probability=False, tol=0.001, cache_size=200, class_weight=None, verbose=False, max_iter=-1, decision_function_shape='ovr', break_ties=False, random_state=None)[source]

Bases: TimeSeriesSVC

predict_proba(X)[source]

Predicts labels probabilities for sequences in X.

Parameters:

X (sktime compatible time series panel data container of Panel scitype) –

time series to predict labels for.

Can be in any mtype of Panel scitype, for instance:

  • pd-multiindex: pd.DataFrame with columns = variables, index = pd.MultiIndex with first level = instance indices, second level = time indices

  • numpy3D: 3D np.array (any number of dimensions, equal length series) of shape [n_instances, n_dimensions, series_length]

  • or of any other supported Panel mtype

for list of mtypes, see datatypes.SCITYPE_REGISTER

for specifications, see examples/AA_datatypes_and_datasets.ipynb

Not all estimators support panels with multivariate or unequal length series, see the tag reference for details.

Returns:

y_pred – predicted class label probabilities 0-th indices correspond to instance indices in X 1-st indices correspond to class index, in same order as in self.classes_ entries are predictive class probabilities, summing to 1

Return type:

2D np.array of int, of shape [n_instances, n_classes]

pyrregular.models.svm.svm_pipeline = Pipeline(steps=[('standardize',                  ApplyFunc(fn_kwargs={},                            func=<function _standardize>)),                 ('convert_to_nested',                  ApplyFunc(fn_kwargs={'to_type': 'nested_univ'},                            func=<function convert_to>)),                 ('drop_na', DropNATransformer()),                 ('svc',                  TimeSeriesSVCFix(kernel=LcssTslearn(global_constraint='sakoe_chiba',                                     sakoe_chiba_radius=10),                  max_iter=1000))])

This pipeline applies standardize → convert_to_nested → drop_na → TimeSeriesSVC with LCSS kernel.