I use SARIMAX from statsmodels.tsa.statespace.sarimax in Python.
I have a simple one column energy consumption dataset with 27679 rows. The frequency is Hour.
I do hyperparameters optimization thanks to Gridsearch and Hyperopt.
To do so, I split NOT RANDOMLY (I used shuffle=False) the dataset into X_train and X_test datasets, and then I split X_train a second time into X_train_subset and X_valid set so I can do the optimization over the X_valid set, and I never use the X_test set except at the end.
from sklearn.model_selection import train_test_split # We want to forecast on 72 hours, 3 days test_size = 72/len(result_data) X_train, X_test = train_test_split(result_data, test_size=test_size, shuffle=False) X_train_subset, X_valid = train_test_split(X_train, test_size=0.3, shuffle=False)
The problem is that, sometimes, I got the best hyperparameters which results from the optimization (fitting on X_train_subset & calculating metrics over X_valid) and then, when I fit the model with these hyperparams on X_train, it won't fit, I got :
ValueError: Non-stationary starting autoregressive parameters found with `enforce_stationarity` set to True.
To resume, for one Sarima model with one combination of hyperparams:
- It fits on X_train_subset.
- It does not fit on X_train.
- X_train_subset is 70% of X_train.
- Both X_train and X_train_subset are stationnary (Dickey Fuller test < 10e-11)
Does someone knows why I got this behaviour and what it means about my model ?