Submitted by ng_guardian t3_11or4qb in MachineLearning

I trained my ARIMA model by doing the following

from statsmodels.tsa.arima.model import ARIMA

model_ar = ARIMA(data.Num_Passengers, order=(1,0, 0))

results_ar = model_ar.fit()results_ar.summary()

​

The code worked with the resulting output

​

https://preview.redd.it/zi8f1lhak5na1.png?width=746&format=png&auto=webp&v=enabled&s=3f5ef9fe1504892e4ce48b5287d8b834f1dfdb27

But then I tried predicting on the testing dataset, and I got the following error.

​

https://preview.redd.it/uni7ws1ck5na1.png?width=1675&format=png&auto=webp&v=enabled&s=ce520334f3b1e420a101adda9f43868714617272

Am I just messing something up, is anyone else dealing with this error?

Is there another way to use the predict function, or is it really unimplemented.

Could you please help me out with this?

How would I overwrite the method?

0

Comments

You must log in or register to comment.

Affectionate_Shine55 t1_jbvqc9r wrote

model_ar.fit().predict(test)

Usually people do

res=model_ar.fit()

res.summary()

preds = res.predict(test)

1

TywinASOIAF t1_jby3znl wrote

Python statmodels is bad. It cannot handle hour data for example. Use R if you do time series.

1

Toilet_Assassin t1_jc0gn35 wrote

In the end the observations you feed to the model will boil down to a sequentially indexed array, so it isn't too much effort to map indices to hour intervals with a time column. You will have to extend the time column to match the forecasted indices though, but that isn't too much effort at the end of the day.

3