MACNNClassifierSKTimeWrapper
Python template · sinapsis_sktime.templates.sktime_classifiers
Overview
Template for SkTime classification model training and inference for the deep_learning module.
MACNNClassifier — inherited documentation
Multi-Scale Attention Convolutional Neural Classifier, as described in [1]_.
Parameters ---------- n_epochs : int, optional (default=1500) The number of epochs to train the model. batch_size : int, optional (default=4) The number of sample per gradient update. padding : str, optional (default="same") The type of padding to be provided in MACNN Blocks. Accepts all the string values that keras.layers supports. Note: For Conv1D layers within MACNN Blocks, padding is always set to "same" to ensure consistent output lengths for multi-scale convolutions. This parameter only affects the pooling layers between MACNN Blocks. pool_size : int, optional (default=3) A single value representing pooling windows which are applied between two MACNN Blocks. strides : int, optional (default=2) A single value representing strides to be taken during the pooling operation. repeats : int, optional (default=2) The number of MACNN Blocks to be stacked. filter_sizes : tuple, optional (default=(64, 128, 256)) The input size of Conv1D layers within each MACNN Block. kernel_size : tuple, optional (default=(3, 6, 12)) The output size of Conv1D layers within each MACNN Block. reduction : int, optional (default = 16) The factor by which the first dense layer of a MACNN Block will be divided by. loss : str, optional (default="categorical_crossentropy") The name of the loss function to be used during training, should be supported by keras. activation : str, optional (default="sigmoid") The activation function to apply at the output. 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/ use_bias : bool, optional (default=True) Whether bias should be included in the output layer. metrics : None or string, optional (default=None) The string which will be used during model compilation. If left as None, then "accuracy" is passed to ``model.compile()``. optimizer: None or keras.optimizers.Optimizer instance, optional (default=None) The optimizer that is used for model compiltation. If left as None, then ``keras.optimizers.Adam(learning_rate=0.0001)`` is used. callbacks : None or list of keras.callbacks.Callback, optional (default=None) The callback(s) to use during training. random_state : int, optional (default=0) The seed to any random action. verbose : bool, optional (default=False) Verbosity during model training, making it ``True`` will print model summary, training information etc.
References ---------- .. [1] Wei Chen et. al, Multi-scale Attention Convolutional Neural Network for time series classification, Neural Networks, Volume 136, 2021, Pages 126-140, ISSN 0893-6080, https://doi.org/10.1016/j.neunet.2021.01.001.
Examples -------- >>> from sktime.classification.deep_learning.macnn import MACNNClassifier >>> 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") >>> macnn = MACNNClassifier(n_epochs=3) # doctest: +SKIP >>> macnn.fit(X_train, y_train) # doctest: +SKIP MACNNClassifier(...)
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. macnnclassifier_init n_epochs <class 'int'>: default: 1500 batch_size <class 'int'>: default: 4 padding <class 'str'>: default: same pool_size <class 'int'>: default: 3… Read full field description
Path where the trained model will be saved. macnnclassifier_init n_epochs <class 'int'>: default: 1500 batch_size <class 'int'>: default: 4 padding <class 'str'>: default: same pool_size <class 'int'>: default: 3 strides <class 'int'>: default: 2 repeats <class 'int'>: default: 2 filter_sizes <class 'tuple'>: default: (64, 128, 256) kernel_size <class 'tuple'>: default: (3, 6, 12) reduction <class 'int'>: default: 16 loss <class 'str'>: default: categorical_crossentropy activation <class 'str'>: default: sigmoid activation_hidden <class 'str'>: default: relu use_bias <class 'bool'>: default: True metrics <class 'NoneType'>: default: None optimizer <class 'NoneType'>: default: None callbacks <class 'NoneType'>: default: None random_state <class 'int'>: default: 0 verbose <class 'bool'>: default: False
Required
Default: null
Required
Default: null
Optional
Default: "categorical_crossentropy"
Optional
Default: null
Optional
Default: "same"
Optional
Default: 2
Optional
Default: 2
Optional
Default: false
Optional
Default: 1500
Optional
Default: true
Optional
Default: null
Optional
Default: null
Optional
Default: 3
Optional
Default: 16
Optional
Default: "sigmoid"
Optional
Default: 4
Optional
Default: [3,6,12]
Optional
Default: [64,128,256]
Optional
Default: 0
Optional
Default: "relu"
Configuration example
Generated from documented defaults. Replace any placeholders and complete required nested settings before running.
templates:
- template_name: "MACNNClassifierSKTimeWrapper"
class_name: "MACNNClassifierSKTimeWrapper"
attributes:
root_dir: "/sinapsis-hub/private/platform/sinapsis-hub/playground/publish"
model_save_path: "<required>"
macnnclassifier_init:
loss: "categorical_crossentropy"
metrics: null
padding: "same"
repeats: 2
strides: 2
verbose: false
n_epochs: 1500
use_bias: true
callbacks: null
optimizer: null
pool_size: 3
reduction: 16
activation: "sigmoid"
batch_size: 4
kernel_size: {}
filter_sizes: {}
random_state: 0
activation_hidden: "relu"
Inheritance
sinapsis_sktime.templates.sktime_classifiers.SKTimeDeepLearningClassifiersEnvironment variables
Environment definitions belong to their canonical Python modules.