Docs /Templates/ sinapsis-sktime

MLPClassifierSKTimeWrapper

sinapsis-sktimeSKTimedynamicinferencemodelsprediction

Python template · sinapsis_sktime.templates.sktime_classifiers

Overview

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

MLPClassifier — inherited documentation

Multi Layer Perceptron Network (MLP), as described in [1]_.

Adapted from the implementation from source code https://github.com/hfawaz/dl-4-tsc/blob/master/classifiers/mlp.py

Parameters ---------- should inherited fields be listed here? n_epochs : int, default = 2000 the number of epochs to train the model batch_size : int, default = 16 the number of samples per gradient update. callbacks : list of keras.callbacks.Callback, optional (default=None) List of Keras callbacks to apply during model training. random_state : int or None, default=None Seed for random number generation. verbose : boolean, default = False whether to output extra information loss : string, default="mean_squared_error" fit parameter for the keras model optimizer : keras.optimizer, default=keras.optimizers.Adam(), metrics : list of strings, default=["accuracy"], activation : string or a tf callable, default="sigmoid" 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/ use_bias : boolean, default = True whether the layer uses a bias vector. optimizer : keras.optimizers object, default = Adam(lr=0.01) specify the optimizer and the learning rate to be used. dropout : float or tuple, default=(0.1, 0.2, 0.2, 0.3) The dropout rate for the hidden layers. If float, the same rate is used for all layers. If tuple, length must equal n_layers + 1, where the first n_layers elements correspond to dropout applied before each hidden Dense layer, and the last element corresponds to the dropout applied after the final hidden layer (before the output layer). n_layers : int, default=3 Number of hidden Dense layers in the MLP. hidden_dim : int or tuple, default=500 Number of units in each hidden Dense layer. If int, the same number of units is used for all hidden layers. If list or tuple, length must equal n_layers, with each element specifying the number of units for the corresponding hidden layer.

References ---------- .. [1] Wang et al, Time series classification from scratch with deep neural networks: A strong baseline, International joint conference on neural networks (IJCNN), 2017.

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

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. mlpclassifier_init n_epochs <class 'int'>: default: 2000 batch_size <class 'int'>: default: 16 callbacks <class 'NoneType'>: default: None verbose <class 'bool'>: default:… Read full field description

Path where the trained model will be saved. mlpclassifier_init n_epochs <class 'int'>: default: 2000 batch_size <class 'int'>: default: 16 callbacks <class 'NoneType'>: default: None verbose <class 'bool'>: default: False loss <class 'str'>: default: categorical_crossentropy metrics <class 'NoneType'>: default: None random_state typing.Optional[int]: default: None activation <class 'str'>: default: sigmoid activation_hidden <class 'str'>: default: relu use_bias <class 'bool'>: default: True optimizer <class 'NoneType'>: default: None dropout typing.Optional[float]: default: (0.1, 0.2, 0.2, 0.3) n_layers <class 'int'>: default: 3 hidden_dim <class 'int'>: default: 500

str
Required
Default: null
mlpclassifier_initRequired
MLPClassifierAttributes
Required
Default: null
loss
str
Optional
Default: "categorical_crossentropy"
dropout
typing.Optional[float]
Optional
Default: [0.1,0.2,0.2,0.3]
metrics
NoneType
Optional
Default: null
verbose
bool
Optional
Default: false
n_epochs
int
Optional
Default: 2000
n_layers
int
Optional
Default: 3
use_bias
bool
Optional
Default: true
callbacks
NoneType
Optional
Default: null
optimizer
NoneType
Optional
Default: null
activation
str
Optional
Default: "sigmoid"
batch_size
int
Optional
Default: 16
hidden_dim
int
Optional
Default: 500
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: "MLPClassifierSKTimeWrapper"
    class_name: "MLPClassifierSKTimeWrapper"
    attributes:
      root_dir: "/sinapsis-hub/private/platform/sinapsis-hub/playground/publish"
      model_save_path: "<required>"
      mlpclassifier_init:
        loss: "categorical_crossentropy"
        dropout: [0.1, 0.2, 0.2, 0.3]
        metrics: null
        verbose: false
        n_epochs: 2000
        n_layers: 3
        use_bias: true
        callbacks: null
        optimizer: null
        activation: "sigmoid"
        batch_size: 16
        hidden_dim: 500
        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