Yash Randive
Yash Randive

Reputation: 23

TypeError: predict() missing 1 required positional argument: 'params' while Predicting values in ARMAX model

This is my code where I am fitting the model

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)

This is the code for forecasting/predicting future trends

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']])

Here is the error trace

---------------------------------------------------------------------------
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'

Upvotes: 1

Views: 1751

Answers (1)

Daniel R
Daniel R

Reputation: 2042

You sould use results_armax.predict instead of model_armax.predict. The predict function of a ARMA model requires you to say the parameters. The predict function of a fitted ARMA model results already has parameters fitted.

See the difference of arguments in the documentation:

Upvotes: 1

Related Questions