Is there a way to save this AIC values?
I want to sort this values to see which model has lowest AIC in order to make cross validation to the ones with lower AIC'senter image description here
I saw this issue in the GitHub page of pmd arima (alkaline-ml/pmdarima).
The answer is from Taylor G. Smith, who actively maintain pmdarima.
There is two ways.
1)
The first one is with the argument return_valid_fits set as True. See pmdarima 1.8.0 documentation:
return_valid_fits : bool, optional (default=False)
If True, will return all valid ARIMA fits in a list. If False (by default), will only return the best fit.
Example:
import pmdarima as pm
sxmodel = pm.auto_arima(endog[:n_train],exog[:n_train], start_p=0, start_q=0, max_p=2, max_q=2,
start_P=0,start_Q=0, max_P=2,max_D=1,max_Q=2, m=7, seasonal=True,
d=0, trace=True, error_action='trace',suppress_warnings=True, stepwise=True)
sxmodel
In this first case the sxmodel will be a tuple with information about the fitted models
2)
The other one is using the sys module:
import sys
orig_stdout = sys.stdout
f = open('out.txt', 'w')
sys.stdout = f
# fit your model
model = pm.auto_arima(...)
sys.stdout = orig_stdout
f.close()