【问题标题】:Performance for adfuller and SARIMAXadfuller 和 SARIMAX 的性能
【发布时间】:2021-10-22 21:50:08
【问题描述】:

这是上一篇文章的延续,但我正在尝试预测每周收入。我的程序似乎挂在 adfuller 测试上。它以前运行过,并且通过 p 值看起来是静止的,但不一致。我也添加了 SARIMAX,代码只是挂起。如果我取消,我会(定期)在底部收到一条消息,说明问题不受限制。

数据:

Week |   Week_Start_Date |Amount |year
Week 1      2018-01-01   42920  2018
Week 2      2018-01-08   37772  2018
Week 3      2018-01-15   41076  2018
Week 4      2018-01-22   38431  2018
Week 5      2018-01-29  101676  2018

代码:

x = organic_search.groupby('Week_Start_Date').Amount.sum()

# Augmented Dickey-Fuller test
ad_fuller_result = adfuller(x)
print(f'ADF Statistic: {ad_fuller_result[0]}')
print(f'p-value: {ad_fuller_result[1]}')

# SARIMA Model
plt.figure(2)
best_model = SARIMAX(x, order=(2, 1, 1), seasonal_order=(2, 1, 1, 52)).fit(dis=1)
print(best_model.summary())
best_model.plot_diagnostics(figsize=(15,12))

我只处理 185 行左右。我不明白为什么代码只是挂起。欢迎任何优化建议(针对 adfuller 和 SARIMAX)。

【问题讨论】:

    标签: performance statsmodels forecasting sarimax


    【解决方案1】:

    通过传递 organic_search['Amount'] 而不是 organic_search.groupby('Week_Start_Date').Amount.sum() 修复

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-15
      • 1970-01-01
      • 2020-03-25
      • 1970-01-01
      • 1970-01-01
      • 2016-11-25
      • 2020-11-30
      • 2020-03-20
      相关资源
      最近更新 更多