Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 1.8 KB

README.md

File metadata and controls

29 lines (22 loc) · 1.8 KB

MOMENT forecasting

  • Original MOMENT repo here.
  • Research repo (with experimentation code) here.
  • MOMENT paper here.

The structure of the code references the MOMENT forecasting tutorial, and the training/eval code from Time-Series-Library.

Currently tuned for the Stock and Demand datasets. Add more dataloaders and run_xx.py scripts as necessary (though most datasets should follow the current run.py workflow, which is to:

  1. pre-evaluate the out-of-the-box MOMENT model,
  2. train the MOMENT model through linear probing, and
  3. evaluate the trained model.

Note

The code currently requires a small change in the MOMENT library to function properly. In the forecast method of the MOMENT class, add a .forecast to the return variable, like so:

  def forecast(
      self, x_enc: torch.Tensor, input_mask: torch.Tensor = None, **kwargs
  ) -> TimeseriesOutputs:
      batch_size, n_channels, seq_len = x_enc.shape

      # ... MOMENT code ...

      dec_out = self.head(enc_out)  # [batch_size x n_channels x forecast_horizon]
      dec_out = self.normalizer(x=dec_out, mode="denorm")

      return TimeseriesOutputs(input_mask=input_mask, forecast=dec_out).forecast

This is so that the existing training/eval code is more in line with that from the Time-Series-Library. All MOMENT methods return a TimeSeriesOutputs object, so this simplifies the output from the model (doesn't require appending .forecast on every other output variable).