MCDCNNRegressorTorch
Multi Channel Deep Convolutional Neural Regressor in PyTorch, adopted from [1].
Quickstart
from sktime.regression.deep_learning.mcdcnn import MCDCNNRegressorTorch
estimator = MCDCNNRegressorTorch(n_epochs: int=120, batch_size: int=16, kernel_sizes: tuple [int, ... ]=(5, 5), pool_size: int=2, filter_sizes: tuple [int, ... ]=(8, 8), dense_units: int=732, conv_padding: str | None='same', pool_padding: str | None='same', activation: str | None | Callable=None, activation_hidden: str | Callable='ReLU', use_bias: bool=True, criterion: str | None | Callable='MSELoss', criterion_kwargs: dict | None=None, optim: str | None | Callable=None, optim_kwargs: dict | None=None, callbacks: str | tuple [str, ... ] | None=None, callback_kwargs: dict | None=None, metrics: None | str | Callable | tuple [str | Callable, ... ]=None, lr: float=0.01, verbose: bool=False, random_state: int=0)Parameters(21)
- n_epochsint, optional (default=120)
- The number of epochs to train the model.
- batch_sizeint, optional (default=16)
- The number of samples per gradient update.
- kernel_sizestuple, optional (default=(5, 5))
- The size of kernels in Conv1D layers.
- pool_sizeint, optional (default=2)
- The size of kernel in (Max) Pool layer.
- filter_sizestuple, optional (default=(8, 8))
- The sizes of filter for Conv1D layer corresponding to each Conv1D in the block.
- dense_unitsint, optional (default=732)
- The number of output units of the final Dense layer of this Network. This is NOT the final layer but the penultimate layer.
- conv_paddingstr or None, optional (default=”same”)
- The type of padding to be applied to convolutional layers.
- pool_paddingstr or None, optional (default=”same”)
- The type of padding to be applied to pooling layers.
- activationstr or Callable or None, optional (default=None)
The activation function to apply at the output. List of available activation functions: https://pytorch.org/docs/stable/nn.html#non-linear-activations-activation
- activation_hiddenstr or Callable, default=”ReLU”
Activation function used in the hidden layers. List of available activation functions: https://pytorch.org/docs/stable/nn.html#non-linear-activations-activation
- use_biasbool, optional (default=True)
- Whether bias should be included in the output layer.
- criterionstr, optional (default=”MSELoss”)
- The name of the loss function to be used during training, should be supported by PyTorch.
- criterion_kwargsdict or None, optional (default=None)
- Additional keyword arguments to pass to the loss function.
- optim: str or None or an instance of optimizers defined in torch.optim,
optional (default=None) The optimizer to use for training the model. If left with None, “SGD” is used with momentum=0.9, weight_decay=0.0005. List of available optimizers: https://pytorch.org/docs/stable/optim.html#algorithms
- optim_kwargsdict or None, optional (default=None)
- Additional keyword arguments to pass to the optimizer. If None, SGD is used with momentum=0.9, weight_decay=0.0005.
- callbacksNone or str or a tuple of str, optional (default=None)
- Currently only learning rate schedulers are supported as callbacks. If more than one scheduler is passed, they are applied sequentially in the order they are passed. If None, then no learning rate scheduler is used.
- callback_kwargsdict or None, optional (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, optional (default=0.01)
- The learning rate to use for the optimizer.
- verbosebool, optional (default=False)
- Whether to print progress information during training.
- random_stateint, optional (default=0)
- The seed to any random action.
Examples
>>> from sktime.regression.deep_learning.mcdcnn import MCDCNNRegressorTorch
>>> from sktime.datasets import load_unit_test
>>> X_train, y_train = load_unit_test (split = "train")
>>> mcdcnn = MCDCNNRegressorTorch (n_epochs = 1, kernel_sizes = (4, 4))
>>> mcdcnn. fit (X_train, y_train) MCDCNNRegressorTorch(
... )References
- [1 ] Zheng et. al, Time series classification using multi-channels deep convolutional neural networks, International Conference on Web-Age Information Management, Pages 298-310, year 2014, organization: Springer.