【问题标题】:TypeError: predict() missing 1 required positional argument: 'params' while Predicting values in ARMAX model类型错误:预测()缺少 1 个必需的位置参数:“参数”同时预测 ARMAX 模型中的值
【发布时间】:2020-07-11 18:33:56
【问题描述】:

这是我拟合模型的代码

model_armax = ARIMA(df.productivity, exog = df[['calories_burnt', 'fat_level', 'distance_walked', 'steps',
                                                   'weight', 'water', 'time_to_bed', 'wakeup_time', 'bedtime',
                                                   'asleep', 'sleep_periods', 'sports_total_time', 'food_quality',
                                                   'food_quantity', 'alcohol', 'energy', 'meditation',
                                                   'mood', 'stress', 'soreness', 'fitness', 'engagement',
                                                   'exploration']], order = (3,0,3))
results_armax = model_armax.fit(disp = 0)

这是预测/预测未来趋势的代码

df_armax_forecast = model_armax.predict(start = '2020-02-22', end = '2020-07-01', 
                                          exog = df_test[['calories_burnt', 'fat_level', 'distance_walked', 'steps',
                                                          'weight', 'water', 'time_to_bed', 'wakeup_time', 'bedtime',
                                                          'asleep', 'sleep_periods', 'sports_total_time', 'food_quality',
                                                          'food_quantity', 'alcohol', 'energy', 'meditation',
                                                          'mood', 'stress', 'soreness', 'fitness', 'engagement',
                                                          'exploration']])

这是错误跟踪

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-177-dc09c88b9c6f> in <module>
      5                                                           'food_quantity', 'alcohol', 'energy', 'meditation',
      6                                                           'mood', 'stress', 'soreness', 'fitness', 'engagement',
----> 7                                                           'exploration']])

TypeError: predict() missing 1 required positional argument: 'params'

【问题讨论】:

    标签: python machine-learning time-series forecasting varcharmax


    【解决方案1】:

    您应该使用results_armax.predict 而不是model_armax.predict。 ARMA 模型的预测功能要求您说出参数。拟合的 ARMA 模型结果的 predict 函数已经拟合了参数。

    查看文档中参数的区别:

    【讨论】:

      猜你喜欢
      • 2021-09-26
      • 2019-09-07
      • 2021-04-16
      • 1970-01-01
      • 1970-01-01
      • 2017-07-23
      • 1970-01-01
      • 2019-11-16
      • 2021-11-30
      相关资源
      最近更新 更多