Skip to content

TimeSeriesSVCTslearn

TimeSeriesSVCTslearn

class TimeSeriesSVCTslearn(C=1.0, kernel='gak', degree=3, gamma='auto', coef0=0.0, shrinking=True, probability=False, tol=0.001, cache_size=200, class_weight=None, n_jobs=None, verbose=0, max_iter=-1, decision_function_shape='ovr', random_state=None)[source]

Time Series Suppoer Vector Classifier, from tslearn.

Direct interface to tslearn.svm.svm.TimeSeriesSVC.

Parameters:
Cfloat, optional (default=1.0)

Penalty parameter C of the error term.

kernelstring, optional (default=’gak’)

Specifies the kernel type to be used in the algorithm. It must be one of ‘gak’ or a kernel accepted by sklearn.svm.SVC. If none is given, ‘gak’ will be used. If a callable is given it is used to pre-compute the kernel matrix from data matrices; that matrix should be an array of shape (n_samples, n_samples).

degreeint, optional (default=3)

Degree of the polynomial kernel function (‘poly’). Ignored by all other kernels.

gammafloat, optional (default=’auto’)

Kernel coefficient for ‘gak’, ‘rbf’, ‘poly’ and ‘sigmoid’. If gamma is ‘auto’ then:

  • for ‘gak’ kernel, it is computed based on a sampling of the training set tslearn.metrics.gamma_soft_dtw

  • for other kernels (eg. ‘rbf’), 1/n_features will be used.

coef0float, optional (default=0.0)

Independent term in kernel function. It is only significant in ‘poly’ and ‘sigmoid’.

shrinkingboolean, optional (default=True)

Whether to use the shrinking heuristic.

probabilityboolean, optional (default=False)

Whether to enable probability estimates. This must be enabled prior to calling fit, and will slow down that method. Also, probability estimates are not guaranteed to match predict output. See our dedicated user guide section for more details.

tolfloat, optional (default=1e-3)

Tolerance for stopping criterion.

cache_sizefloat, optional (default=200.0)

Specify the size of the kernel cache (in MB).

class_weight{dict, ‘balanced’}, optional

Set the parameter C of class i to class_weight[i]*C for SVC. If not given, all classes are supposed to have weight one. The “balanced” mode uses the values of y to automatically adjust weights inversely proportional to class frequencies in the input data as n_samples / (n_classes * np.bincount(y))

n_jobsint or None, optional (default=None)

The number of jobs to run in parallel for GAK cross-similarity matrix computations. None means 1 unless in a joblib.parallel_backend context. -1 means using all processors. See scikit-learns’ Glossary for more details.

verboseint, default: 0

Enable verbose output. Note that this setting takes advantage of a per-process runtime setting in libsvm that, if enabled, may not work properly in a multithreaded context.

max_iterint, optional (default=-1)

Hard limit on iterations within solver, or -1 for no limit.

decision_function_shape‘ovo’, ‘ovr’, default=’ovr’

Whether to return a one-vs-rest (‘ovr’) decision function of shape (n_samples, n_classes) as all other classifiers, or the original one-vs-one (‘ovo’) decision function of libsvm which has shape (n_samples, n_classes * (n_classes - 1) / 2).

random_stateint, RandomState instance or None, optional (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.

Attributes:
support_array-like, shape = [n_SV]

Indices of support vectors.

n_support_array-like, dtype=int32, shape = [n_class]

Number of support vectors for each class.

support_vectors_list of arrays of shape [n_SV, sz, d]

List of support vectors in tslearn dataset format, one array per class

dual_coef_array, shape = [n_class-1, n_SV]

Coefficients of the support vector in the decision function. For multiclass, coefficient for all 1-vs-1 classifiers. The layout of the coefficients in the multiclass case is somewhat non-trivial. See the section about multi-class classification in the SVM section of the User Guide of sklearn for details.

coef_array, shape = [n_class-1, n_features]

Weights assigned to the features (coefficients in the primal problem). This is only available in the case of a linear kernel. coef_ is a readonly property derived from dual_coef_ and support_vectors_.

intercept_array, shape = [n_class * (n_class-1) / 2]

Constants in decision function.

svm_estimator_sklearn.svm.SVC

The underlying sklearn estimator

Methods

check_is_fitted([method_name])

Check if the estimator has been fitted.

clone()

Obtain a clone of the object with same hyper-parameters and config.

clone_tags(estimator[, tag_names])

Clone tags from another object as dynamic override.

create_test_instance([parameter_set])

Construct an instance of the class, using first test parameter set.

create_test_instances_and_names([parameter_set])

Create list of all test instances and a list of names for them.

fit(X, y)

Fit time series classifier to training data.

fit_predict(X, y[, cv, change_state])

Fit and predict labels for sequences in X.

fit_predict_proba(X, y[, cv, change_state])

Fit and predict labels probabilities for sequences in X.

get_class_tag(tag_name[, tag_value_default])

Get class tag value from class, with tag level inheritance from parents.

get_class_tags()

Get class tags from class, with tag level inheritance from parent classes.

get_config()

Get config flags for self.

get_fitted_params([deep])

Get fitted parameters.

get_param_defaults()

Get object's parameter defaults.

get_param_names([sort])

Get object's parameter names.

get_params([deep])

Get a dict of parameters values for this object.

get_tag(tag_name[, tag_value_default, ...])

Get tag value from instance, with tag level inheritance and overrides.

get_tags()

Get tags from instance, with tag level inheritance and overrides.

get_test_params([parameter_set])

Return testing parameter settings for the estimator.

is_composite()

Check if the object is composed of other BaseObjects.

load_from_path(serial)

Load object from file location.

load_from_serial(serial)

Load object from serialized memory container.

predict(X)

Predicts labels for sequences in X.

predict_proba(X)

Predicts labels probabilities for sequences in X.

reset()

Reset the object to a clean post-init state.

save([path, serialization_format])

Save serialized self to bytes-like object or to (.zip) file.

score(X, y)

Scores predicted labels against ground truth labels on X.

set_config(**config_dict)

Set config flags to given values.

set_params(**params)

Set the parameters of this object.

set_random_state([random_state, deep, ...])

Set random_state pseudo-random seed parameters for self.

set_tags(**tag_dict)

Set instance level tag overrides to given values.