Docs /Templates/ sinapsis-sktime

TapNetClassifierSKTimeWrapper

sinapsis-sktimeSKTimedynamicinferencemodelsprediction

Python template · sinapsis_sktime.templates.sktime_classifiers

Overview

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

TapNetClassifier — inherited documentation

Time series attentional prototype network (TapNet), as described in [1]_.

Parameters ---------- n_epochs : int, default = 2000 number of epochs to train the model batch_size : int, default = 16 number of samples per update dropout : float, default = 0.5 dropout rate for the convolutional layers, in the range [0, 1) filter_sizes : tuple of int, default = (256, 256, 128) number of convolutional filters in each conv block kernel_size : tuple of int, default = (8, 5, 3) specifying the length of the 1D convolution window dilation : int, default = 1 dilation value layers : tuple of int, default = (500, 300) sizes of dense layers use_rp : bool, default = True whether to use random projections rp_group : int, default = 3 number of random permutation groups g for random dimension permutation rp_alpha : float, default = 2.0 scale factor alpha used to compute the RDP group size: ``` rp_dim = floor(n_dims * rp_alpha / rp_group) ``` activation : str or callable, default = "sigmoid" activation function for the last output layer List of available activation functions: https://keras.io/api/layers/activations/ activation_hidden : str or callable, default = "leaky_relu" activation function for the hidden layers List of available activation functions: https://keras.io/api/layers/activations/ use_bias : bool, default = True whether to use bias in the output dense layer use_att : bool, default = True whether to use self attention use_lstm : bool, default = True whether to use an LSTM layer use_cnn : bool, default = True whether to use a CNN layer random_state : int or None, default = None seed for random padding : str, default = 'same' type of padding for convolution layers loss : str, default = "binary_crossentropy" loss function for the classifier optimizer : str or None, default = "Adam(lr=0.01)" gradient updating function for the classifier metrics : list of str or None, default = None list of metrics to be evaluated by the model during training and testing callbacks : list of keras.callbacks.Callback, optional (default=None) List of Keras callbacks to apply during model training. verbose : bool, default = False whether to output extra information lstm_dropout : float, default = 0.8 dropout rate for the LSTM layer, in the range [0, 1) fc_dropout : float, default = 0.0 dropout rate before the output layer, in the range (0, 1]

Attributes ---------- n_classes : int number of classes extracted from the data

References ---------- .. [1] Zhang et al. Tapnet: Multivariate time series classification with attentional prototypical network, Proceedings of the AAAI Conference on Artificial Intelligence 34(4), 6845-6852, 2020

Examples -------- >>> from sktime.classification.deep_learning.tapnet import TapNetClassifier >>> from sktime.datasets import load_unit_test >>> X_train, y_train = load_unit_test(split="train") >>> X_test, y_test = load_unit_test(split="test") >>> tapnet = TapNetClassifier(n_epochs=20,batch_size=4) # doctest: +SKIP >>> tapnet.fit(X_train, y_train) # doctest: +SKIP TapNetClassifier(...)

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. tapnetclassifier_init n_epochs <class 'int'>: default: 2000 batch_size <class 'int'>: default: 16 dropout <class 'float'>: default: 0.5 filter_sizes <class 'tuple'>: default:… Read full field description

Path where the trained model will be saved. tapnetclassifier_init n_epochs <class 'int'>: default: 2000 batch_size <class 'int'>: default: 16 dropout <class 'float'>: default: 0.5 filter_sizes <class 'tuple'>: default: (256, 256, 128) kernel_size <class 'tuple'>: default: (8, 5, 3) dilation <class 'int'>: default: 1 layers <class 'tuple'>: default: (500, 300) use_rp <class 'bool'>: default: True rp_group <class 'int'>: default: 3 rp_alpha <class 'float'>: default: 2.0 activation <class 'str'>: default: sigmoid activation_hidden <class 'str'>: default: leaky_relu use_bias <class 'bool'>: default: True use_att <class 'bool'>: default: True use_lstm <class 'bool'>: default: True use_cnn <class 'bool'>: default: True random_state typing.Optional[int]: default: None padding <class 'str'>: default: same loss <class 'str'>: default: binary_crossentropy optimizer typing.Optional[str]: default: None metrics <class 'NoneType'>: default: None callbacks <class 'NoneType'>: default: None verbose <class 'bool'>: default: False lstm_dropout <class 'float'>: default: 0.8 fc_dropout <class 'float'>: default: 0.0

str
Required
Default: null
tapnetclassifier_initRequired
TapNetClassifierAttributes
Required
Default: null
loss
str
Optional
Default: "binary_crossentropy"
layers
tuple
Optional
Default: [500,300]
use_rp
bool
Optional
Default: true
dropout
float
Optional
Default: 0.5
metrics
NoneType
Optional
Default: null
padding
str
Optional
Default: "same"
use_att
bool
Optional
Default: true
use_cnn
bool
Optional
Default: true
verbose
bool
Optional
Default: false
dilation
int
Optional
Default: 1
n_epochs
int
Optional
Default: 2000
rp_alpha
float
Optional
Default: 2
rp_group
int
Optional
Default: 3
use_bias
bool
Optional
Default: true
use_lstm
bool
Optional
Default: true
callbacks
NoneType
Optional
Default: null
optimizer
typing.Optional[str]
Optional
Default: null
activation
str
Optional
Default: "sigmoid"
batch_size
int
Optional
Default: 16
fc_dropout
float
Optional
Default: 0
kernel_size
tuple
Optional
Default: [8,5,3]
filter_sizes
tuple
Optional
Default: [256,256,128]
lstm_dropout
float
Optional
Default: 0.8
random_state
typing.Optional[int]
Optional
Default: null
activation_hidden
str
Optional
Default: "leaky_relu"

Configuration example

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

yaml
templates:
  - template_name: "TapNetClassifierSKTimeWrapper"
    class_name: "TapNetClassifierSKTimeWrapper"
    attributes:
      root_dir: "/sinapsis-hub/private/platform/sinapsis-hub/playground/publish"
      model_save_path: "<required>"
      tapnetclassifier_init:
        loss: "binary_crossentropy"
        layers: {}
        use_rp: true
        dropout: 0.5
        metrics: null
        padding: "same"
        use_att: true
        use_cnn: true
        verbose: false
        dilation: 1
        n_epochs: 2000
        rp_alpha: 2
        rp_group: 3
        use_bias: true
        use_lstm: true
        callbacks: null
        optimizer: null
        activation: "sigmoid"
        batch_size: 16
        fc_dropout: 0
        kernel_size: {}
        filter_sizes: {}
        lstm_dropout: 0.8
        random_state: null
        activation_hidden: "leaky_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