LSTMFCNClassifierSKTimeWrapper
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 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. 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
Required
Default: null
Required
Default: null
Optional
Default: 0.8
Optional
Default: 0
Optional
Default: 2000
Optional
Default: false
Optional
Default: null
Optional
Default: 8
Optional
Default: "softmax"
Optional
Default: 128
Optional
Default: [128,256,128]
Optional
Default: [8,5,3]
Optional
Default: null
Optional
Default: "relu"
Configuration example
Generated from documented defaults. Replace any placeholders and complete required nested settings before running.
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
sinapsis_sktime.templates.sktime_classifiers.SKTimeDeepLearningClassifiersEnvironment variables
Environment definitions belong to their canonical Python modules.