Docs /Templates/ sinapsis-sktime

IndividualBOSSSKTimeWrapper

sinapsis-sktimeSKTimedynamicinferencemodelsprediction

Python template · sinapsis_sktime.templates.sktime_classifiers

Overview

Template for SkTime classification model training and inference for the dictionary_based module.

IndividualBOSS — inherited documentation

Single bag of Symbolic Fourier Approximation Symbols (IndividualBOSS).

Bag of SFA Symbols Ensemble: implementation of a single BOSS Schaffer, the base classifier for the boss ensemble.

Implementation of single BOSS model from Schäfer (2015). [1]_

This is the underlying classifier for each classifier in the BOSS ensemble.

Overview: input "n" series of length "m" and IndividualBoss performs a SFA transform to form a sparse dictionary of discretised words. The resulting dictionary is used with the BOSS distance function in a 1-nearest neighbor.

Fit involves finding "n" histograms.

Predict uses 1 nearest neighbor with a bespoke BOSS distance function.

Parameters ---------- window_size : int Size of the window to use in BOSS algorithm. word_length : int Length of word to use to use in BOSS algorithm. norm : bool, default = False Whether to normalize words by dropping the first Fourier coefficient. alphabet_size : default = 2 Number of possible letters (values) for each word. save_words : bool, default = True Whether to keep NumPy array of words in SFA transformation even after the dictionary of words is returned. If True, the array is saved, which can shorten the time to calculate dictionaries using a shorter ``word_length`` (since the last "n" letters can be removed). store_histogram : bool, default = False Whether to store the histograms of words in ``fit``. If False, avoids storing the histograms in memory, which can be large for some datasets. n_jobs : int, default=1 The number of jobs to run in parallel for both ``fit`` and ``predict``. ``-1`` means using all processors. random_state : int or None, default=None Seed for random, integer.

Attributes ---------- n_classes_ : int Number of classes. Extracted from the data. classes_ : list The classes labels. histograms_ : list of dict A list of dictionaries, where each dictionary is a word histogram for an individual time series instance. The length of the list is equal to the number of instances passed to ``fit``. Each dictionary maps SFA words (str) to their frequency (int). Only created if ``store_histogram`` is ``True``.

See Also -------- BOSSEnsemble, ContractableBOSS

Notes ----- For the Java version, see `TSML <https://github.com/uea-machine-learning/tsml/blob/master/src/main/java/ tsml/classifiers/dictionary_based/IndividualBOSS.java>`_.

References ---------- .. [1] Patrick Schäfer, "The BOSS is concerned with time series classification in the presence of noise", Data Mining and Knowledge Discovery, 29(6): 2015 https://link.springer.com/article/10.1007/s10618-014-0377-7

Examples -------- >>> from sktime.classification.dictionary_based import IndividualBOSS >>> from sktime.datasets import load_unit_test >>> X_train, y_train = load_unit_test(split="train", return_X_y=True) >>> X_test, y_test = load_unit_test(split="test", return_X_y=True) # doctest: +SKIP >>> clf = IndividualBOSS() # doctest: +SKIP >>> clf.fit(X_train, y_train) # doctest: +SKIP IndividualBOSS(...) >>> y_pred = clf.predict(X_test) # doctest: +SKIP

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. individualboss_init window_size <class 'int'>: default: 10 word_length <class 'int'>: default: 8 norm <class 'bool'>: default: False alphabet_size <class 'int'>: default: 2… Read full field description

Path where the trained model will be saved. individualboss_init window_size <class 'int'>: default: 10 word_length <class 'int'>: default: 8 norm <class 'bool'>: default: False alphabet_size <class 'int'>: default: 2 save_words <class 'bool'>: default: False store_histogram <class 'bool'>: default: False n_jobs <class 'int'>: default: 1 random_state typing.Optional[int]: default: None

str
Required
Default: null
individualboss_initRequired
IndividualBOSSAttributes
Required
Default: null
norm
bool
Optional
Default: false
n_jobs
int
Optional
Default: 1
save_words
bool
Optional
Default: false
window_size
int
Optional
Default: 10
word_length
int
Optional
Default: 8
random_state
typing.Optional[int]
Optional
Default: null
alphabet_size
int
Optional
Default: 2
store_histogram
bool
Optional
Default: false

Configuration example

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

yaml
templates:
  - template_name: "IndividualBOSSSKTimeWrapper"
    class_name: "IndividualBOSSSKTimeWrapper"
    attributes:
      root_dir: "/sinapsis-hub/private/platform/sinapsis-hub/playground/publish"
      model_save_path: "<required>"
      individualboss_init:
        norm: false
        n_jobs: 1
        save_words: false
        window_size: 10
        word_length: 8
        random_state: null
        alphabet_size: 2
        store_histogram: false

Inheritance

Immediate parent: sinapsis_sktime.templates.sktime_classifiers.SKTimeDictionaryClassifiers

Environment variables

Environment definitions belong to their canonical Python modules.

SINAPSIS_BUILD_DOCS · defined elsewhere