paddlets.models.forecasting.dl.tft
This implementation is based on the article Temporal Fusion Transformers for Interpretable Multi-horizon Time Series Forecasting.
- class TFTModel(in_chunk_len: int, out_chunk_len: int, hidden_size: int = 64, lstm_layers_num: int = 1, attention_heads_num: int = 1, output_quantiles: ~typing.List[float] = [0.1, 0.5, 0.9], dropout: float = 0.0, skip_chunk_len: int = 0, sampling_stride: int = 1, loss_fn: ~typing.Callable[[...], ~paddle.Tensor] = <bound method QuantileRegression.loss of <paddlets.models.forecasting.dl.distributions.likelihood.QuantileRegression object>>, optimizer_fn: ~typing.Callable[[...], ~paddle.optimizer.optimizer.Optimizer] = <class 'paddle.optimizer.adam.Adam'>, optimizer_params: ~typing.Dict[str, ~typing.Any] = {'learning_rate': 0.0001}, callbacks: ~typing.List[~paddlets.models.common.callbacks.callbacks.Callback] = [], batch_size: int = 128, max_epochs: int = 10, verbose: int = 1, patience: int = 4, seed: int = 0)[source]
Bases:
PaddleBaseModelImplImplementation of TFT model.
- 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.
hidden_size (int, Optional) – The number of features in the hidden state of the TFT module.
lstm_layers_num (int, Optional) – The number of LSTM layers.
attention_heads_num (int, Optional) – The number of heads of self-attention module.
output_quantiles (List[float], Optional) – The output quantiles of the model.
dropout (float, Optional) – The fraction of neurons that are dropped in all-but-last RNN layers.
skip_chunk_len (int, Optional) – 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, optional) – sampling intervals between two adjacent samples.
loss_fn (Callable, Optional) – loss function.
optimizer_fn (Callable, Optional) – optimizer algorithm.
optimizer_params (Dict, Optional) – optimizer parameters.
callbacks (List[Callback], Optional) – customized callback functions.
batch_size (int, Optional) – number of samples per batch.
max_epochs (int, Optional) – max epochs during training.
verbose (int, Optional) – verbosity mode.
patience (int, Optional) – number of epochs with no improvement after which learning rate wil be reduced.
seed (int, Optional) – global random seed.