gluonts.torch.model.patch_tst.module module#
- class gluonts.torch.model.patch_tst.module.PatchTSTModel(prediction_length: int, context_length: int, patch_len: int, stride: int, padding_patch: str, d_model: int, nhead: int, dim_feedforward: int, num_feat_dynamic_real: int, dropout: float, activation: str, norm_first: bool, num_encoder_layers: int, scaling: Optional[str], distr_output=gluonts.torch.distributions.studentT.StudentTOutput(beta=0.0))[source]#
Bases:
Module
Module implementing the PatchTST model for forecasting as described in https://arxiv.org/abs/2211.14730 extended to be probabilistic.
- Parameters:
prediction_length – Number of time points to predict.
context_length – Number of time steps prior to prediction time that the model.
num_feat_dynamic_real – Number of dynamic real features in the data (default: 0).
distr_output – Distribution to use to evaluate observations and sample predictions. Default:
StudentTOutput()
.
- forward(past_target: Tensor, past_observed_values: Tensor, past_time_feat: Optional[Tensor] = None, future_time_feat: Optional[Tensor] = None) Tuple[Tuple[Tensor, ...], Tensor, Tensor] [source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.