Back to models
Regressor

InceptionTimeRegressorTorch

InceptionTime Deep Learning Regressor in PyTorch.

Adapted from the implementation from Fawaz et. al https://github.com/hfawaz/InceptionTime/blob/master/classifiers/inception.py

Quickstart

python
from sktime.regression.deep_learning.inceptiontime import InceptionTimeRegressorTorch

estimator = InceptionTimeRegressorTorch(num_epochs: int=1500, n_conv_layers: int=3, n_filters: int=32, batch_size: int=64, kernel_size: int=40, use_residual: bool=True, use_bottleneck: bool=True, bottleneck_size: int=32, depth: int=6, activation: str | Callable | None=None, activation_hidden: str | Callable='ReLU', activation_inception: str | Callable | None=None, optimizer: str | None | Callable='Adam', optimizer_kwargs: dict | None=None, criterion: str | None | Callable='MSELoss', criterion_kwargs: dict | None=None, callbacks: None | str | tuple [str, ... ]=None, callback_kwargs: dict | None=None, metrics: None | str | Callable | tuple [str | Callable, ... ]=None, lr: float=0.001, init_weights: str | None=None, verbose: bool=False, random_state: int | None=None)

Parameters(23)

num_epochsint, default=1500
The number of epochs to train the model.
n_conv_layersint, default=3
Number of convolutional branches in each inception module. Make sure base kernel size is divisible by 2^(n_conv_layers-1) to avoid errors. This implementation is adapted from [1].
n_filtersint, default=32
Number of filters in the convolution layers
batch_sizeint, default=64
The size of each mini-batch during training.
kernel_sizeint, default=40
Base kernel size for inception modules
use_residualbool, default=True
If True, uses residual connections
use_bottleneckbool, default=True
If True, uses bottleneck layer in inception modules
bottleneck_sizeint, default=32
Size of the bottleneck layer
depthint, default=6
Number of inception modules to stack
activationstr, Callable, or None, default=None

Activation applied to the output layer.

Permitted values:

  • None: no activation is applied to the output layer and the network returns raw outputs.

  • str: name of a class in torch.nn. Case-sensitive names are recommended and must match PyTorch (e.g., "ReLU", "LeakyReLU"). Lowercase aliases for common activations are also accepted (e.g., "relu" is resolved to "ReLU"). The class is instantiated with default constructor arguments. Must be a valid torch.nn activation; see https://pytorch.org/docs/stable/nn.html#non-linear-activations-weighted-sum-nonlinearity

  • torch.nn.Module: an instance of a torch.nn.Module subclass, for example torch.nn.ReLU(). Arbitrary callables are not supported.

Recommended activations: ReLU, Tanh, Sigmoid, LeakyReLU, ELU, SELU, GELU.

activation_hiddenstr, Callable, or None, default=”ReLU”

Activation applied to the hidden layers (output from inception modules).

Permitted values:

  • None: no activation is applied to the hidden layers.

  • str: name of a class in torch.nn. Case-sensitive names are recommended and must match PyTorch (e.g., "ReLU", "LeakyReLU"). Lowercase aliases for common activations are also accepted (e.g., "relu" is resolved to "ReLU"). The class is instantiated with default constructor arguments. Must be a valid torch.nn activation; see https://pytorch.org/docs/stable/nn.html#non-linear-activations-weighted-sum-nonlinearity

  • torch.nn.Module: an instance of a torch.nn.Module subclass, for example torch.nn.ReLU(). Arbitrary callables are not supported.

Recommended activations: ReLU, Tanh, Sigmoid, LeakyReLU, ELU, SELU, GELU.

activation_inceptionstr, Callable, or None, default=None

Activation applied inside the inception modules.

Permitted values:

  • None: no activation is applied inside the inception modules.

  • str: name of a class in torch.nn. Case-sensitive names are recommended and must match PyTorch (e.g., "ReLU", "LeakyReLU"). Lowercase aliases for common activations are also accepted (e.g., "relu" is resolved to "ReLU"). The class is instantiated with default constructor arguments. Must be a valid torch.nn activation; see https://pytorch.org/docs/stable/nn.html#non-linear-activations-weighted-sum-nonlinearity

  • torch.nn.Module: an instance of a torch.nn.Module subclass, for example torch.nn.ReLU(). Arbitrary callables are not supported.

Recommended activations: ReLU, Tanh, Sigmoid, LeakyReLU, ELU, SELU, GELU.

optimizercase insensitive str or None or an instance of optimizers
defined in torch.optim, default = “Adam” The optimizer to use for training the model.
optimizer_kwargsdict or None, default = None
Additional keyword arguments to pass to the optimizer.
criterioncase insensitive str or None or an instance of a loss function
defined in PyTorch, default = “MSELoss” The loss function to be used in training the neural network.
criterion_kwargsdict or None, default = None
Additional keyword arguments to pass to the loss function.
callbacksNone or str or a tuple of str, default = None
Currently only learning rate schedulers are supported as callbacks.
callback_kwargsdict or None, default = None
The keyword arguments to be passed to the callbacks.
metricsNone or str or Callable or tuple of str and/or Callable, default = None

Metrics to compute during training. If None, no metrics are computed beyond the loss. Metrics are computed from torchmetrics library. If a string/Callable is passed, it must be one of the metrics defined in https://lightning.ai/docs/torchmetrics/stable/ Examples: “MeanSquaredError”, “MeanAbsoluteError”, “R2Score”

lrfloat, default = 0.001
The learning rate to use for the optimizer.
init_weightsstr or None, default = None
The method to initialize the weights of the conv layers. Supported values are ‘kaiming_uniform’, ‘kaiming_normal’, ‘xavier_uniform’, ‘xavier_normal’, or None for default PyTorch initialization.
verbosebool, default = False
Whether to print progress information during training.
random_stateint or None, default = None
Seed to ensure reproducibility.

Examples

>>> from sktime.regression.deep_learning.inceptiontime import (
... InceptionTimeRegressorTorch
... )
>>> 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")
>>> reg = InceptionTimeRegressorTorch (num_epochs = 50, batch_size = 2)
>>> reg. fit (X_train, y_train) InceptionTimeRegressorTorch(
... )