paddlets.models.forecasting.dl.lstnet

class LSTNetRegressor(in_chunk_len: int, out_chunk_len: int, skip_chunk_len: int = 0, sampling_stride: int = 1, loss_fn: ~typing.Callable[[...], ~paddle.Tensor] = <function mse_loss>, optimizer_fn: ~typing.Callable[[...], ~paddle.optimizer.optimizer.Optimizer] = <class 'paddle.optimizer.adam.Adam'>, optimizer_params: ~typing.Dict[str, ~typing.Any] = {'learning_rate': 0.001}, eval_metrics: ~typing.List[str] = [], callbacks: ~typing.List[~paddlets.models.common.callbacks.callbacks.Callback] = [], batch_size: int = 32, max_epochs: int = 100, verbose: int = 1, patience: int = 10, seed: ~typing.Union[None, int] = None, skip_size: int = 1, channels: int = 1, kernel_size: int = 3, rnn_cell_type: str = 'GRU', rnn_num_cells: int = 10, skip_rnn_cell_type: str = 'GRU', skip_rnn_num_cells: int = 10, dropout_rate: float = 0.2, output_activation: ~typing.Optional[str] = None)[source]

Bases: PaddleBaseModelImpl

LSTNet[1] is a time series forecasting model introduced in 2018. LSTNet uses the Convolution Neural Network (CNN) and the Recurrent Neural Network (RNN) to extract short-term local dependency patterns among variables and to discover long-term patterns for time series trends.

[1] Lai G, et al. “Modeling Long- and Short-Term Temporal Patterns with Deep Neural Networks”, https://arxiv.org/abs/1703.07015

Parameters
  • in_chunk_len (int) – The size of the loopback window, i.e. the number of time steps feed to the model.

  • out_chunk_len (int) – The size of the forecasting horizon, i.e. the number of time steps output by the model.

  • skip_chunk_len (int) – Optional, the number of time steps between in_chunk and out_chunk for a single sample. The skip chunk is neither used as a feature (i.e. X) nor a label (i.e. Y) for a single sample. By default it will NOT skip any time steps.

  • sampling_stride (int) – Sampling intervals between two adjacent samples.

  • loss_fn (Callable[..., paddle.Tensor]|None) – Loss function.

  • optimizer_fn (Callable[..., Optimizer]) – Optimizer algorithm.

  • optimizer_params (Dict[str, Any]) – Optimizer parameters.

  • eval_metrics (List[str]) – Evaluation metrics of model.

  • callbacks (List[Callback]) – Customized callback functions.

  • batch_size (int) – Number of samples per batch.

  • max_epochs (int) – Max epochs during training.

  • verbose (int) – Verbosity mode.

  • patience (int) – Number of epochs to wait for improvement before terminating.

  • seed (int|None) – Global random seed.

  • skip_size (int) – Skip size for the skip RNN layer.

  • channels (int) – Number of channels for first layer Conv1D.

  • kernel_size (int) – Kernel size for first layer Conv1D.

  • rnn_cell_type (str) – Type of the RNN cell, Either GRU or LSTM.

  • rnn_num_cells (int) – Number of RNN cells for each layer.

  • skip_rnn_cell_type (str) – Type of the RNN cell for the skip layer, Either GRU or LSTM.

  • skip_rnn_num_cells (int) – Number of RNN cells for each layer for skip part.

  • dropout_rate (float) – Dropout regularization parameter.

  • output_activation (str|None) – The last activation to be used for output. Accepts either None (default no activation), sigmoid or tanh.

_in_chunk_len

The size of the loopback window, i.e. the number of time steps feed to the model.

Type

int

_out_chunk_len

The size of the forecasting horizon, i.e. the number of time steps output by the model.

Type

int

_skip_chunk_len

Optional, the number of time steps between in_chunk and out_chunk for a single sample. The skip chunk is neither used as a feature (i.e. X) nor a label (i.e. Y) for a single sample. By default it will NOT skip any time steps.

Type

int

_sampling_stride

Sampling intervals between two adjacent samples.

Type

int

_loss_fn

Loss function.

Type

Callable[…, paddle.Tensor]

_optimizer_fn

Optimizer algorithm.

Type

Callable[…, Optimizer]

_optimizer_params

Optimizer parameters.

Type

Dict[str, Any]

_eval_metrics

Evaluation metrics of model.

Type

List[str]

_callbacks

Customized callback functions.

Type

List[Callback]

_batch_size

Number of samples per batch.

Type

int

_max_epochs

Max epochs during training.

Type

int

_verbose

Verbosity mode.

Type

int

_patience

Number of epochs to wait for improvement before terminating.

Type

int

_seed

Global random seed.

Type

int|None

_stop_training
Type

bool

_skip_size

Skip size for the skip RNN layer.

Type

int

_channels

Number of channels for first layer Conv1D.

Type

int

_kernel_size

Kernel size for first layer Conv1D.

Type

int

_rnn_cell_type

Type of the RNN cell, Either GRU or LSTM.

Type

str

_rnn_num_cells

Number of RNN cells for each layer.

Type

int

_skip_rnn_cell_type

Type of the RNN cell for the skip layer, Either GRU or LSTM.

Type

str

_skip_rnn_num_cells

Number of RNN cells for each layer for skip part.

Type

int

_dropout_rate

Dropout regularization parameter.

Type

float

_output_activation

The last activation to be used for output. Accepts either None (default no activation), sigmoid or tanh.

Type

str|None