salesforce / Merlion

Merlion: A Machine Learning Framework for Time Series Intelligence
BSD 3-Clause "New" or "Revised" License
3.36k stars 295 forks source link

[BUG] `output_size` property is None in DeepARModel #154

Closed AlbertoLanaro closed 1 year ago

AlbertoLanaro commented 1 year ago

Describe the bug

output_size property for DeepARModel class (or other deep-learning-based models (???)) is None.

Error message:

[/usr/local/lib/python3.10/dist-packages/merlion/models/forecast/deep_ar.py](https://localhost:8080/#) in __init__(self, config)
     86         freq_map = {"h": 4, "t": 5, "s": 6, "m": 1, "a": 1, "w": 2, "d": 3, "b": 3}
     87 
---> 88         input_size = len(self.lags_seq) * self.output_size + freq_map[config.ts_encoding]
     89 
     90         # for decoding the lags are shifted by one, at the first time-step

TypeError: unsupported operand type(s) for *: 'int' and 'NoneType'

I think the problem is that the property dim of the Config class is always set to None in the __init__ function (link)

To Reproduce

from merlion.models.forecast.deep_ar import DeepARModel, DeepARConfig

deep_ar_config = DeepARConfig(n_past=10, max_forecast_steps=20, lags_seq=[1], batch_size=32)
deep_ar = DeepARModel(deep_ar_config)

Expected behavior Model is initialized correctly.

Desktop (please complete the following information):

AlbertoLanaro commented 1 year ago

Just realized I should be using the DeepARForecaster class instead of the DeepARModel. Maybe the documentation clould be clearer on this. Thank you anyway.