Docs /Templates/ sinapsis-sktime

LSTMFCNClassifierSKTimeWrapper

sinapsis-sktimeSKTimedynamicinferencemodelsprediction

Python template · sinapsis_sktime.templates.sktime_classifiers

Overview

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

LSTMFCNClassifier — inherited documentation

Implementation of LSTMFCNClassifier from Karim et al (2019) [1].

Combines an LSTM arm with a CNN arm. Optionally uses an attention mechanism in the LSTM which the author indicates provides improved performance.

Parameters ---------- activation : string or a tf callable, default="softmax" Activation function used in the output layer. List of available activation functions: https://keras.io/api/layers/activations/ activation_hidden : string or a tf callable, default="relu" Activation function used in the hidden layers. List of available activation functions: https://keras.io/api/layers/activations/ n_epochs : int, default=2000 the number of epochs to train the model batch_size : int, default=128 the number of samples per gradient update. dropout : float, default=0.8 controls dropout rate of LSTM layer kernel_sizes : list or tuple of int, default=(8, 5, 3) Length of the 1D convolution windows for each convolutional layer. The number of convolutional layers is ``len(kernel_sizes)``. Must have the same length as ``filter_sizes``. Defaults match Karim et al. (2019): three layers with kernels 8, 5, 3. filter_sizes : list or tuple of int, default=(128, 256, 128) Number of filters for each convolutional layer. The number of convolutional layers is ``len(filter_sizes)``. Must have the same length as ``kernel_sizes``. Defaults match Karim et al. (2019): three layers with 128, 256, 128 filters. lstm_size : int, default=8 output dimension for LSTM layer attention : boolean, default=False If True, uses custom attention LSTM layer callbacks : keras callbacks, default=ReduceLRonPlateau Keras callbacks to use such as learning rate reduction or saving best model based on validation error verbose : 'auto', 0, 1, or 2. Verbosity mode. 0 = silent, 1 = progress bar, 2 = one line per epoch. 'auto' defaults to 1 for most cases, but 2 when used with ``ParameterServerStrategy``. Note that the progress bar is not particularly useful when logged to a file, so verbose=2 is recommended when not running interactively (eg, in a production environment). random_state : int or None, default=None Seed for random, integer.

References ---------- .. [1] Karim et al. Multivariate LSTM-FCNs for Time Series Classification, 2019 https://arxiv.org/pdf/1801.04503.pdf

Examples -------- >>> import sktime.classification.deep_learning as dl_clf # doctest: +SKIP >>> from dl_clf.lstmfcn import LSTMFCNClassifier # doctest: +SKIP >>> 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) >>> lstmfcn = FCNClassifier(n_epochs=20,batch_size=4) # doctest: +SKIP >>> lstmfcn.fit(X_train, y_train) # doctest: +SKIP FCNClassifier(...)

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. lstmfcnclassifier_init n_epochs <class 'int'>: default: 2000 batch_size <class 'int'>: default: 128 dropout <class 'float'>: default: 0.8 kernel_sizes <class 'tuple'>:… Read full field description

Path where the trained model will be saved. lstmfcnclassifier_init n_epochs <class 'int'>: default: 2000 batch_size <class 'int'>: default: 128 dropout <class 'float'>: default: 0.8 kernel_sizes <class 'tuple'>: default: (8, 5, 3) filter_sizes <class 'tuple'>: default: (128, 256, 128) lstm_size <class 'int'>: default: 8 attention <class 'bool'>: default: False callbacks <class 'NoneType'>: default: None random_state typing.Optional[int]: default: None verbose typing.Optional[ForwardRef('auto')]: default: 0 activation <class 'str'>: default: softmax activation_hidden <class 'str'>: default: relu

str
Required
Default: null
lstmfcnclassifier_initRequired
LSTMFCNClassifierAttributes
Required
Default: null
dropout
float
Optional
Default: 0.8
verbose
typing.Optional[ForwardRef('auto')]
Optional
Default: 0
n_epochs
int
Optional
Default: 2000
attention
bool
Optional
Default: false
callbacks
NoneType
Optional
Default: null
lstm_size
int
Optional
Default: 8
activation
str
Optional
Default: "softmax"
batch_size
int
Optional
Default: 128
filter_sizes
tuple
Optional
Default: [128,256,128]
kernel_sizes
tuple
Optional
Default: [8,5,3]
random_state
typing.Optional[int]
Optional
Default: null
activation_hidden
str
Optional
Default: "relu"

Configuration example

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

yaml
templates:
  - template_name: "LSTMFCNClassifierSKTimeWrapper"
    class_name: "LSTMFCNClassifierSKTimeWrapper"
    attributes:
      root_dir: "/sinapsis-hub/private/platform/sinapsis-hub/playground/publish"
      model_save_path: "<required>"
      lstmfcnclassifier_init:
        dropout: 0.8
        verbose: 0
        n_epochs: 2000
        attention: false
        callbacks: null
        lstm_size: 8
        activation: "softmax"
        batch_size: 128
        filter_sizes: {}
        kernel_sizes: {}
        random_state: null
        activation_hidden: "relu"

Inheritance

Immediate parent: sinapsis_sktime.templates.sktime_classifiers.SKTimeDeepLearningClassifiers

Environment variables

Environment definitions belong to their canonical Python modules.

SINAPSIS_BUILD_DOCS · defined elsewhere