Statsmodels ARIMA、值警告、日期索引和相关频率信息

Statsmodels ARIMA, Value warning, date index and associated frequency information

我目前正在 python 中构建 ARIMA 模型并遇到了这个错误,在查看错误代码时我并不真正理解这个错误。我很好奇它是否会影响模型中的参数,如果有人可以就此问题提出建议,我将不胜感激,可能会提出修复建议。

已提供日期索引,但它没有关联的频率信息,因此将被忽略,例如预测。

https://i.stack.imgur.com/sNZjd.png

github 中的错误文档中的代码如下:

date_index = isinstance(index, (DatetimeIndex, PeriodIndex))

    if date_index and not has_freq:
        warnings.warn('A date index has been provided, but it has no'
                      ' associated frequency information and so will be'
                      ' ignored when e.g. forecasting.', ValueWarning)

这是我的数据框。我将日期时间设置为我的数据帧索引。

https://i.stack.imgur.com/rlkd0.png

需要说明的是,代码仍然可以执行,并且可以打印结果摘要。

当您的日期索引没有与 it.You 相关联的频率且未提供与 data/time 索引相关联的定义频率(如季度、月度等)时,会出现此警告。

此警告的意思是您不能按日期指定预测步骤,预测和 get_forecast 方法的输出将没有关联的日期。原因是如果没有给定的频率,就无法确定每个预测应分配到的日期。尝试像下面这样指定一个时间段:

df.index = pd.DatetimeIndex(df.index).to_period('M')

在此处阅读此页面以了解更多详细信息。 https://www.statsmodels.org/stable/examples/notebooks/generated/statespace_forecasting.html