Docs /Templates/ sinapsis-sktime

BOSSVSClassifierPytsSKTimeWrapper

sinapsis-sktimeSKTimedynamicinferencemodelsprediction

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 set

Installation

Install the published package using pip or uv.

Terminalbash
pip install sinapsis-sktime==1.0.0
uv pip install sinapsis-sktime==1.0.0
uv add sinapsis-sktime==1.0.0

Configuration

Effective fields from the inspector schema, including nested Pydantic model fields.

metadata
sinapsis_core.template_base.base_models.TemplateMetadata | None
Optional
Default: null
root_dir
str
Optional
Default: "/sinapsis-hub/private/platform/sinapsis-hub/playground/publish"
model_save_pathRequired
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

str
Required
Default: null
bossvsclassifierpyts_initRequired
BOSSVSClassifierPytsAttributes
Required
Default: null
anova
typing.Optional[bool]
Optional
Default: false
n_bins
typing.Optional[int]
Optional
Default: 4
use_idf
typing.Optional[bool]
Optional
Default: true
alphabet
NoneType
Optional
Default: null
drop_sum
typing.Optional[bool]
Optional
Default: false
norm_std
typing.Optional[bool]
Optional
Default: false
strategy
typing.Optional[str]
Optional
Default: "quantile"
norm_mean
typing.Optional[bool]
Optional
Default: false
word_size
typing.Optional[int]
Optional
Default: 4
smooth_idf
typing.Optional[bool]
Optional
Default: false
window_size
int
Optional
Default: 10
window_step
int
Optional
Default: 1
sublinear_tf
typing.Optional[bool]
Optional
Default: true
numerosity_reduction
typing.Optional[bool]
Optional
Default: true

Configuration example

Generated from documented defaults. Replace any placeholders and complete required nested settings before running.

yaml
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

Immediate parent: sinapsis_sktime.templates.sktime_classifiers.SKTimeDictionaryClassifiers

Environment variables

Environment definitions belong to their canonical Python modules.

SINAPSIS_BUILD_DOCS · defined elsewhere