Pytorch-forecasting:: Univariate AssertionError: filters should not remove entries all entries

1.2k views Asked by At

I tried to do univariate forecasting with Pytorch-Forecasting.

But I got following error on TimeSeriesDataSet

AssertionError: filters should not remove entries all entries - check encoder/decoder lengths and lags

I have tried googling for the error, read the suggestion and make sure my training_df has sufficient number of rows. (I have plenty: 196). Also I only has 1 group_id which is 1. No other group_id, so all those 196 should be in same group.

My dataframes sample:

note: all rows has same group value = 1

    PutCall_Ratio_Total  time_idx  group 

Date
2006-02-24 11119.140000 0 1 2006-02-25 7436.316667 1 1
2006-02-26 3753.493333 2 1

I have training_df with length of 196

len(training_df) 196

And here is my TimeSeriesDataSet portion:

 context_length = 28*7
 prediction_length = 7 
     # setup Pytorch Forecasting TimeSeriesDataSet for training data
     training_data = TimeSeriesDataSet(
         training_df,
         time_idx="time_idx",
         target="PutCall_Ratio_Total",
         group_ids=["group"],
         time_varying_unknown_reals=["PutCall_Ratio_Total"],
         max_encoder_length=context_length,
         max_prediction_length=prediction_length
     )```
2

There are 2 answers

0
Mikasa On

After some experiment, it seems that the training_df length (196) should be larger than or equal to (context_length + prediction_length).

So for example above it works once I update the context_length to 27 * 7 instead of 28 * 7.

Since 27 * 7 + 7 = 196.
While 28 * 7 + 7 > 196.

0
Эдуард Владимиров On

As for me, the solution was to drop higher lags lags={'target': [7, 30]} instead of lags={'target': [7, 30, 365]}, because some timeseries were short enough