Skip to content

BOSSVSClassifierPyts

BOSSVSClassifierPyts

class BOSSVSClassifierPyts(word_size=4, n_bins=4, window_size=10, window_step=1, anova=False, drop_sum=False, norm_mean=False, norm_std=False, strategy='quantile', alphabet=None, numerosity_reduction=True, use_idf=True, smooth_idf=False, sublinear_tf=True)[source]

Bag-of-SFA Symbols in Vector Space, from pyts.

Direct interface to pyts.classification.BOSSVS, author of the interfaced class is johannfaouzi.

Each time series is transformed into an histogram using the Bag-of-SFA Symbols (BOSS) algorithm. Then, for each class, the histograms are added up and a tf-idf vector is computed. The predicted class for a new sample is the class giving the highest cosine similarity between its tf vector and the tf-idf vectors of each class.

Parameters:
word_sizeint (default = 4)

Size of each word.

n_binsint (default = 4)

The number of bins to produce. It must be between 2 and 26.

window_sizeint or float (default = 10)

Size of the sliding window. If float, it represents the percentage of the size of each time series and must be between 0 and 1. The window size will be computed as ceil(window_size * n_timestamps).

window_stepint or float (default = 1)

Step of the sliding window. If float, it represents the percentage of the size of each time series and must be between 0 and 1. The window size will be computed as ceil(window_step * n_timestamps).

anovabool (default = False)

If True, the Fourier coefficient selection is done via a one-way ANOVA test. If False, the first Fourier coefficients are selected.

drop_sumbool (default = False)

If True, the first Fourier coefficient (i.e. the sum of the subseries) is dropped. Otherwise, it is kept.

norm_meanbool (default = False)

If True, center each subseries before scaling.

norm_stdbool (default = False)

If True, scale each subseries to unit variance.

strategystr (default = ‘quantile’)

Strategy used to define the widths of the bins:

  • ‘uniform’: All bins in each sample have identical widths

  • ‘quantile’: All bins in each sample have the same number of points

  • ‘normal’: Bin edges are quantiles from a standard normal distribution

  • ‘entropy’: Bin edges are computed using information gain

alphabetNone, ‘ordinal’ or array-like, shape = (n_bins,)

Alphabet to use. If None, the first n_bins letters of the Latin alphabet are used.

numerosity_reductionbool (default = True)

If True, delete sample-wise all but one occurrence of back to back identical occurrences of the same words.

use_idfbool (default = True)

Enable inverse-document-frequency reweighting.

smooth_idfbool (default = False)

Smooth idf weights by adding one to document frequencies, as if an extra document was seen containing every term in the collection exactly once. Prevents zero divisions.

sublinear_tfbool (default = True)

Apply sublinear tf scaling, i.e. replace tf with 1 + log(tf).

Attributes:
idf_array, shape = (n_features,) , or None

The learned idf vector (global term weights) when use_idf=True, None otherwise.

tfidf_array, shape = (n_classes, n_words)

Term-document matrix.

vocabulary_dict

A mapping of feature indices to terms.

References

[1]

P. Schäfer, “Scalable Time Series Classification”. Data Mining and Knowledge Discovery, 30(5), 1273-1298 (2016).

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.