BOSSVSClassifierPytsSKTimeWrapper
Python template · sinapsis_sktime.templates.sktime_classifiers
Overview
Template for SkTime classification model training and inference for the dictionary_based module.
BOSSVSClassifierPyts — inherited documentation
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_size : int (default = 4) Size of each word.
n_bins : int (default = 4) The number of bins to produce. It must be between 2 and 26.
window_size : int 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_step : int 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)``.
anova : bool (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_sum : bool (default = False) If True, the first Fourier coefficient (i.e. the sum of the subseries) is dropped. Otherwise, it is kept.
norm_mean : bool (default = False) If True, center each subseries before scaling.
norm_std : bool (default = False) If True, scale each subseries to unit variance.
strategy : str (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
alphabet : None, 'ordinal' or array-like, shape = (n_bins,) Alphabet to use. If None, the first `n_bins` letters of the Latin alphabet are used.
numerosity_reduction : bool (default = True) If True, delete sample-wise all but one occurrence of back to back identical occurrences of the same words.
use_idf : bool (default = True) Enable inverse-document-frequency reweighting.
smooth_idf : bool (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_tf : bool (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).
Capabilities
Capabilities: not setInstallation
Install the published package using pip or uv.
pip install sinapsis-sktime==1.0.0uv pip install sinapsis-sktime==1.0.0uv add sinapsis-sktime==1.0.0Configuration
Effective fields from the inspector schema, including nested Pydantic model fields.
Optional
Default: null
Optional
Default: "/sinapsis-hub/private/platform/sinapsis-hub/playground/publish"
Path where the trained model will be saved. bossvsclassifierpyts_init word_size typing.Optional[ForwardRef('int')]: default: 4 n_bins typing.Optional[ForwardRef('int')]: default: 4 window_size <class 'int'>: default:… Read full field description
Path where the trained model will be saved. bossvsclassifierpyts_init word_size typing.Optional[ForwardRef('int')]: default: 4 n_bins typing.Optional[ForwardRef('int')]: default: 4 window_size <class 'int'>: default: 10 window_step <class 'int'>: default: 1 anova typing.Optional[ForwardRef('bool')]: default: False drop_sum typing.Optional[ForwardRef('bool')]: default: False norm_mean typing.Optional[ForwardRef('bool')]: default: False norm_std typing.Optional[ForwardRef('bool')]: default: False strategy typing.Optional[ForwardRef('str')]: default: quantile alphabet <class 'NoneType'>: default: None numerosity_reduction typing.Optional[ForwardRef('bool')]: default: True use_idf typing.Optional[ForwardRef('bool')]: default: True smooth_idf typing.Optional[ForwardRef('bool')]: default: False sublinear_tf typing.Optional[ForwardRef('bool')]: default: True
Required
Default: null
Required
Default: null
Optional
Default: false
Optional
Default: 4
Optional
Default: true
Optional
Default: null
Optional
Default: false
Optional
Default: false
Optional
Default: "quantile"
Optional
Default: false
Optional
Default: 4
Optional
Default: false
Optional
Default: 10
Optional
Default: 1
Optional
Default: true
Optional
Default: true
Configuration example
Generated from documented defaults. Replace any placeholders and complete required nested settings before running.
templates:
- template_name: "BOSSVSClassifierPytsSKTimeWrapper"
class_name: "BOSSVSClassifierPytsSKTimeWrapper"
attributes:
root_dir: "/sinapsis-hub/private/platform/sinapsis-hub/playground/publish"
model_save_path: "<required>"
bossvsclassifierpyts_init:
anova: false
n_bins: 4
use_idf: true
alphabet: null
drop_sum: false
norm_std: false
strategy: "quantile"
norm_mean: false
word_size: 4
smooth_idf: false
window_size: 10
window_step: 1
sublinear_tf: true
numerosity_reduction: true
Inheritance
sinapsis_sktime.templates.sktime_classifiers.SKTimeDictionaryClassifiersEnvironment variables
Environment definitions belong to their canonical Python modules.