Docs /Templates/ sinapsis-sktime

GRUClassifierSKTimeWrapper

sinapsis-sktimeSKTimedynamicinferencemodelsprediction

Python template · sinapsis_sktime.templates.sktime_classifiers

Overview

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

GRUClassifier — inherited documentation

Gated Recurrent Unit (GRU) for time series classification.

This classifier has been wrapped around implementations from [1]_, [2]_ and [3]_.

Parameters ---------- hidden_dim : int Number of features in the hidden state. n_layers : int Number of recurrent layers. batch_first : bool If True, then the input and output tensors are provided as (batch, seq, feature), default is False. bias : bool If False, then the layer does not use bias weights, default is True. init_weights : bool If True, then the weights are initialized, default is True. dropout : float Dropout rate to apply. default is 0.0 fc_dropout : float Dropout rate to apply to the fully connected layer. default is 0.0 bidirectional : bool If True, then the GRU is bidirectional, default is False. num_epochs : int, optional (default=10) The number of epochs to train the model. optimizer : str, optional (default=None) The optimizer to use. If None, Adam will be used. activation : str, optional (default="relu") The activation function to use. Options: ["relu", "softmax"]. batch_size : int, optional (default=8) The size of each mini-batch during training. criterion : callable, optional (default=None) The loss function to use. If None, CrossEntropyLoss will be used. criterion_kwargs : dict, optional (default=None) Additional keyword arguments to pass to the loss function. optimizer_kwargs : dict, optional (default=None) Additional keyword arguments to pass to the optimizer. lr : float, optional (default=0.001) The learning rate to use for the optimizer. verbose : bool, optional (default=False) Whether to print progress information during training. random_state : int, optional (default=None) Seed to ensure reproducibility.

References ---------- .. [1] Cho, Kyunghyun, et al. "Learning phrase representations using RNN encoder-decoder for statistical machine translation." arXiv preprint arXiv:1406.1078 (2014). .. [2] Junyoung Chung, Caglar Gulcehre, KyungHyun Cho, Yoshua Bengio. Empirical Evaluation of Gated Recurrent Neural Networks on Sequence Modeling. arXiv preprint arXiv:1412.3555 (2014). .. [3] https://pytorch.org/docs/stable/generated/torch.nn.GRU.html

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

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. gruclassifier_init hidden_dim <class 'int'>: default: 256 n_layers <class 'int'>: default: 4 batch_first <class 'bool'>: default: False bias <class 'bool'>: default: True… Read full field description

Path where the trained model will be saved. gruclassifier_init hidden_dim <class 'int'>: default: 256 n_layers <class 'int'>: default: 4 batch_first <class 'bool'>: default: False bias <class 'bool'>: default: True init_weights <class 'bool'>: default: True dropout <class 'float'>: default: 0.0 fc_dropout <class 'float'>: default: 0.0 bidirectional <class 'bool'>: default: False num_epochs <class 'int'>: default: 10 batch_size <class 'int'>: default: 8 optimizer typing.Optional[str]: default: None criterion typing.Optional[str]: default: None criterion_kwargs typing.Optional[dict]: default: None optimizer_kwargs typing.Optional[dict]: default: None lr <class 'float'>: default: 0.001 verbose <class 'bool'>: default: False random_state typing.Optional[int]: default: None

str
Required
Default: null
gruclassifier_initRequired
GRUClassifierAttributes
Required
Default: null
lr
float
Optional
Default: 0.001
bias
bool
Optional
Default: true
dropout
float
Optional
Default: 0
verbose
bool
Optional
Default: false
n_layers
int
Optional
Default: 4
criterion
typing.Optional[str]
Optional
Default: null
optimizer
typing.Optional[str]
Optional
Default: null
batch_size
int
Optional
Default: 8
fc_dropout
float
Optional
Default: 0
hidden_dim
int
Optional
Default: 256
num_epochs
int
Optional
Default: 10
batch_first
bool
Optional
Default: false
init_weights
bool
Optional
Default: true
random_state
typing.Optional[int]
Optional
Default: null
bidirectional
bool
Optional
Default: false
criterion_kwargs
typing.Optional[dict]
Optional
Default: null
optimizer_kwargs
typing.Optional[dict]
Optional
Default: null

Configuration example

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

yaml
templates:
  - template_name: "GRUClassifierSKTimeWrapper"
    class_name: "GRUClassifierSKTimeWrapper"
    attributes:
      root_dir: "/sinapsis-hub/private/platform/sinapsis-hub/playground/publish"
      model_save_path: "<required>"
      gruclassifier_init:
        lr: 0.001
        bias: true
        dropout: 0
        verbose: false
        n_layers: 4
        criterion: null
        optimizer: null
        batch_size: 8
        fc_dropout: 0
        hidden_dim: 256
        num_epochs: 10
        batch_first: false
        init_weights: true
        random_state: null
        bidirectional: false
        criterion_kwargs: null
        optimizer_kwargs: null

Inheritance

Immediate parent: sinapsis_sktime.templates.sktime_classifiers.SKTimeDeepLearningClassifiers

Environment variables

Environment definitions belong to their canonical Python modules.

SINAPSIS_BUILD_DOCS · defined elsewhere