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

问题描述 投票:0回答:2

我尝试使用 Pytorch-Forecasting 进行单变量预测。

但是我在 TimeSeriesDataSet 上遇到以下错误

AssertionError:过滤器不应删除条目所有条目 - 检查 编码器/解码器长度和滞后

我尝试用谷歌搜索错误,阅读建议并确保我的 training_df 有足够的行数。 (我有很多:196)。此外,我只有 1 个 group_id,即 1。没有其他 group_id,所以所有这 196 个应该在同一组中。

我的数据框示例:

注意:所有行都具有相同的组值 = 1

    PutCall_Ratio_Total  time_idx  group 

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

我有长度为 196 的 training_df

len(training_df) 196

这是我的 TimeSeriesDataSet 部分:

 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
     )```
deep-learning time-series pytorch-forecasting
2个回答
1
投票

经过一些实验,似乎training_df长度(196)应该更大 大于或等于(context_length + prediction_length)。

因此,例如,一旦我将 context_length 更新为 27 * 7 而不是 28 * 7,它就会起作用。

因为 27 * 7 + 7 = 196.
而 28 * 7 + 7 > 196.


0
投票

对我来说,解决方案是降低更高的滞后

lags={'target': [7, 30]}
而不是
lags={'target': [7, 30, 365]}
,因为有些时间序列足够短

© www.soinside.com 2019 - 2024. All rights reserved.