I asked a question before on how to get parameter combination for seasonal Arima model and that has been fixed. I am trying to get the best prediction with ARIMA, how do I explore my parameters? I checked some of the few answers here, but it didn't match what I want.
Here is the Example of a parameter combination for my seasonal Arima model
SARIMAX: (0, 0, 1) X (0, 0, 1, 12)
SARIMAX: (0, 0, 1) X (0, 1, 0, 12)
SARIMAX: (0, 1, 0) X (0, 1, 1, 12)
SARIMAX: (0, 1, 0) X (1, 0, 0, 12)
My code snippet here:
for param in pdq:
for param_seasonal in seasonal_pdq:
try:
mod =\
sm.tsa.statespace.SARIMAX(y_to_train,
order=param,
enforce_invertibility=False)
results = mod.fit
print('SARIMA{}x{}12 - AIC:{}'\
.format(param, param_seasonal, results.aic))
except Exception as ex:
print(ex)
continue
error: AttributeError: 'function' object has no attribute 'fit'
Please, note that y_train is my trained dataset
In order to get the best prediction, it’s important to find the values of SARIMA(p,d,q) that optimize a metric of interest. You can use the "grid search" to iteratively explore different combinations of parameters. The evaluation metric for the grid search is the AIC (Akaike Information Criterion) value. The AIC measures how well a model fits the data while taking into account the overall complexity of the model. In general, it allows you to pick the combination with the lowest AIC value.
I have reviewed your code and You did not pass some parameters in your sm.tsa.statespace.SARIMAX
method and that is the reason why you are getting error: AttributeError: 'function' object has no attribute 'fit
'
Below is the modification of your code:
for param in pdq:
for param_seasonal in seasonal_pdq:
try:
mod =\
sm.tsa.statespace.SARIMAX(y_to_train,
order=param,
seasonal_order=param_seasonal,
enforce_invertibility=False)
results = mod.fit()
print('SARIMA{}x{}12 - AIC:{}'\
.format(param, param_seasonal, results.aic))
except Exception as ex:
print(ex)
continue
You can see that you did not pass seasonal_order=param_seasonal