gluonts.torch.model.mqf2.module module#

class gluonts.torch.model.mqf2.module.MQF2MultiHorizonModel(freq: str, context_length: int, prediction_length: int, num_feat_dynamic_real: int, num_feat_static_real: int, num_feat_static_cat: int, cardinality: List[int], distr_output: Optional[MQF2DistributionOutput] = None, embedding_dimension: Optional[List[int]] = None, num_layers: int = 2, hidden_size: int = 40, dropout_rate: float = 0.1, lags_seq: Optional[List[int]] = None, scaling: bool = True, num_parallel_samples: int = 100, icnn_hidden_size: int = 20, icnn_num_layers: int = 2, is_energy_score: bool = True, threshold_input: float = 100, es_num_samples: int = 50, estimate_logdet: bool = False)[source]#

Bases: DeepARModel

forward(feat_static_cat: Tensor, feat_static_real: Tensor, past_time_feat: Tensor, past_target: Tensor, past_observed_values: Tensor, future_time_feat: Tensor, num_parallel_samples: Optional[int] = None) Tensor[source]#

Generates the predicted sample paths.

Parameters:
  • feat_static_cat – Static categorical features (batch_size, num_feat_static_cat)

  • feat_static_real – Static real-valued features (batch_size, num_feat_static_real)

  • past_time_feat – Past time features (batch_size, history_length, num_features)

  • past_target – Past target values (batch_size, history_length)

  • past_observed_values – Indicator whether or not the values were observed (batch_size, history_length)

  • future_time_feat – Future time features (batch_size, prediction_length, num_features)

  • num_parallel_samples – Number of parallel sample paths generated for each time series

Returns:

Sample paths (batch_size, num_parallel_samples, prediction_length)

Return type:

sample_paths

loss(feat_static_cat: ~torch.Tensor, feat_static_real: ~torch.Tensor, past_time_feat: ~torch.Tensor, past_target: ~torch.Tensor, past_observed_values: ~torch.Tensor, future_time_feat: ~torch.Tensor, future_target: ~torch.Tensor, future_observed_values: ~torch.Tensor, future_only: bool = False, aggregate_by=<built-in method mean of type object>) Tensor[source]#
output_distribution(picnn: SequentialNet, hidden_state: Tensor, scale: Optional[Tensor] = None, inference: bool = False) Distribution[source]#

Returns the MQF2Distribution instance.

Parameters:
  • picnn – A SequentialNet instance of a partially input convex neural network (picnn)

  • hidden_state – RNN hidden state (batch_size, context_length, hidden_size)

  • scale – scaling of the data (batch_size, 1)

  • inference – If True, pass only the last hidden state to the forecaster for prediction Otherwise, pass all the hidden states to train the forecaster

Returns:

MQF2 parametrized by hidden_state

Return type:

MQF2Distribution instance