Select and convert string output as new variable? (python)

Viewed 26

I have run the auto_arima function

stepwise_fit = auto_arima(df['Prices'], trace=True, suppress_warnings=True)

and got a result like this:

Performing stepwise search to minimize aic
 ARIMA(2,1,2)(0,0,0)[0] intercept   : AIC=494.041, Time=0.05 sec
 ARIMA(0,1,0)(0,0,0)[0] intercept   : AIC=696.515, Time=0.01 sec
 [...]
 ARIMA(2,1,1)(0,0,0)[0]             : AIC=492.187, Time=0.03 sec
 ARIMA(2,1,3)(0,0,0)[0]             : AIC=494.056, Time=0.07 sec

Best model:  ARIMA(1,1,2)(0,0,0)[0]
Total fit time: 0.877 seconds

When I do:

print(stepwise_fit) 
print(type(stepwise_fit)

it gives this:

 ARIMA(1,1,2)(0,0,0)[0]
 <class 'pmdarima.arima.arima.ARIMA'>

The values (1,1,2) are important for training and thus i have to manually set

parameter = (1,1,2)

However, I want to feed this into the training code automatically but bluntly setting in "stepwise_fit" doesn't work:

ARIMAmodel = ARIMA(train, order = stepwise_fit)

Error:

'ARIMA' object is not subscriptable

Anyone more experience with this than me and knows how to feed in the found model automatically? I am a coding beginner :(

0 Answers
Related