kdgutier / esrnn_torch

MIT License
156 stars 44 forks source link

Error during training, from input_size, output_size and time span incompatibility #16

Closed ramdhan1989 closed 4 years ago

ramdhan1989 commented 4 years ago

Hi, I am trying to train my own dataset. the data is monthly basis with end of months as the timestamp (ds). the procedure also require y_hat_benchmark if I use test dataframe. below is the error :

`Infered frequency: M =============== Training ESRNN ===============


AssertionError Traceback (most recent call last)

in 1 model.fit(train[['unique_id','ds','x']], train[['unique_id','ds','y']], ----> 2 test[['unique_id','ds','x']], test[['unique_id','ds','y','y_hat_naive_1']],y_hat_benchmark='y_hat_naive_1') ~\Anaconda3\envs\nlp\lib\site-packages\ESRNN\ESRNN.py in fit(self, X_df, y_df, X_test_df, y_test_df, y_hat_benchmark, warm_start, shuffle, verbose) 366 self._fitted = True 367 self.train(dataloader=self.train_dataloader, max_epochs=self.mc.max_epochs, --> 368 warm_start=warm_start, shuffle=shuffle, verbose=verbose) 369 370 def instantiate_esrnn(self, exogenous_size, n_series): ~\Anaconda3\envs\nlp\lib\site-packages\ESRNN\ESRNN.py in train(self, dataloader, max_epochs, warm_start, shuffle, verbose) 184 185 batch = dataloader.get_batch() --> 186 windows_y, windows_y_hat, levels = self.esrnn(batch) 187 188 # Pinball loss on normalized values ~\Anaconda3\envs\nlp\lib\site-packages\torch\nn\modules\module.py in __call__(self, *input, **kwargs) 548 result = self._slow_forward(*input, **kwargs) 549 else: --> 550 result = self.forward(*input, **kwargs) 551 for hook in self._forward_hooks.values(): 552 hook_result = hook(self, input, result) ~\Anaconda3\envs\nlp\lib\site-packages\ESRNN\utils\ESRNN.py in forward(self, ts_object) 271 def forward(self, ts_object): 272 # ES Forward --> 273 windows_y_hat, windows_y, levels, seasonalities = self.es(ts_object) 274 275 # RNN Forward ~\Anaconda3\envs\nlp\lib\site-packages\torch\nn\modules\module.py in __call__(self, *input, **kwargs) 548 result = self._slow_forward(*input, **kwargs) 549 else: --> 550 result = self.forward(*input, **kwargs) 551 for hook in self._forward_hooks.values(): 552 hook_result = hook(self, input, result) ~\Anaconda3\envs\nlp\lib\site-packages\ESRNN\utils\ESRNN.py in forward(self, ts_object) 52 windows_range = range(windows_start, windows_end) 53 n_windows = len(windows_range) ---> 54 assert n_windows>0 55 56 # Initialize windows, levels and seasonalities AssertionError:`
kdgutier commented 4 years ago

Check that the input_size, output_size and n_time of your series are compatible. It is likely that you have a short time series, if so try to inpute values to the short time series to make the sizes compatible. The assertion is a protection for when there are no available observations.

ramdhan1989 commented 4 years ago

thanks a lot