salesforce / Merlion

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

[BUG] Issue to configure Prophet #173

Open ivan-marroquin opened 1 month ago

ivan-marroquin commented 1 month ago

Describe the bug Thanks for such great package!

I am following the jupyter notebook 1_AnomalyFeatures. I get the following error when the Prophet model is configured:

TypeError: to_dict() missing 1 required positional argument: 'self'

To Reproduce Just run the three first cells in the notebook

Expected behavior Have the Prophet model configured without error

Screenshots TypeError Traceback (most recent call last) Cell In [35], line 32 28 # Prophet is a popular forecasting algorithm. Here, we specify that we would like 29 # to pre-processes the input time series by applying a difference transform, 30 # before running the model on it. 31 config3= ProphetDetectorConfig(transform= DifferenceTransform) ---> 32 model3= ProphetDetector(config3)

File ~/python_3.9.0/lib/python3.9/site-packages/merlion/models/forecast/prophet.py:124, in Prophet.init(self, config) 123 def init(self, config: ProphetConfig): --> 124 super().init(config) 125 self.model = prophet.Prophet( 126 yearly_seasonality=self.yearly_seasonality, 127 weekly_seasonality=self.weekly_seasonality, (...) 131 holidays=None if self.holidays is None else pd.DataFrame(self.holidays), 132 )

File ~/python_3.9.0/lib/python3.9/site-packages/merlion/models/forecast/base.py:79, in ForecasterBase.init(self, config) 78 def init(self, config: ForecasterConfig): ---> 79 super().init(config) 80 self.target_name = None 81 self.exog_dim = None ... ---> 67 value = value.to_dict() 68 elif isinstance(value, Enum): 69 value = value.name # Relies on there being an appropriate getter/setter!

TypeError: to_dict() missing 1 required positional argument: 'self'

Desktop (please complete the following information):

AtanasGruev commented 1 week ago

Hello, I was able to reproduce the error. In your case, note that the problem arises from incorrectly passing DifferenceTransform instead of DifferenceTransform() as the transform argument in ProphetDetectorConfig on line 31.