gluonts.torch.model.lag_tst.module 模块#

class gluonts.torch.model.lag_tst.module.LagTSTModel(prediction_length: int, context_length: int, freq: str, d_model: int, nhead: int, dim_feedforward: int, dropout: float, activation: str, norm_first: bool, num_encoder_layers: int, scaling: str, lags_seq: Optional[List[int]] = None, distr_output=gluonts.torch.distributions.studentT.StudentTOutput(beta=0.0))[source]#

基类: torch.nn.modules.module.Module

实现 LagTST 模型用于时间序列预测的模块。

参数
  • prediction_length – 要预测的时间点数量。

  • context_length – 预测时间点之前模型考虑的时间步数量。

  • distr_output – 用于评估观测值和样本预测的分布。默认值: StudentTOutput()

describe_inputs(batch_size=1) gluonts.model.inputs.InputSpec[source]#
forward(past_target: torch.Tensor, past_observed_values: torch.Tensor) Tuple[Tuple[torch.Tensor, ...], torch.Tensor, torch.Tensor][source]#

定义每次调用时执行的计算。

应由所有子类重写。

注意

尽管前向传播的实现需要在此函数中定义,但之后应该调用 Module 实例而不是此函数,因为前者会处理已注册的钩子,而后者会静默忽略它们。

loss(past_target: torch.Tensor, past_observed_values: torch.Tensor, future_target: torch.Tensor, future_observed_values: torch.Tensor) torch.Tensor[source]#
training: bool#