I am try to forecast 700 different product using autoARIMA in pmdarima package. For seasonality, Fourier Series makes it easier, because all products pattern are different.
But, how can I select different values of "k", based on product in a loop. Is there any test, or optimization function to do so?
pipe = Pipeline([
("fourier", FourierFeaturizer(m=12, k=3)),
("arima", pm.AutoARIMA(exogenous=None, start_p=1, d=None, start_q=1, max_p=3,
max_d=2, max_q=3, start_P=1, D=None, start_Q=1, max_P=2,
max_D=1, max_Q=2, max_order=10, m=12, seasonal=False,
stationary=False, information_criterion='aic', alpha=0.05,
test='kpss', seasonal_test='ocsb', stepwise=False, n_jobs=1,
start_params=None, trend=None, method=None, transparams=True,
solver='nm', maxiter=None, disp=0, callback=None,
offset_test_args=None, seasonal_test_args=None,
suppress_warnings=True, error_action='warn', trace=True,
random=False, random_state=20, n_fits=30,`enter code here`
return_valid_fits=False, out_of_sample_size=0, scoring='mse',
scoring_args=None, with_intercept=True))])
Please suggest. Thank you.
Below is the loop created to get the value of K for fourier transformation using minimal AIC. My data is at month frequency. It works for me.
aic_best = np.inf
len_k = 0
trans = FourierFeaturizer(12, k)
y_prime, exog = trans.fit_transform(y_train)
model_auto_arima = auto_arima(y_train, exogenous=exog, start_p=1, d=None, start_q=1, max_p=4, max_d=3, max_q=4, start_P=1,
D=None, start_Q=1, max_P=2, max_D=1, max_Q=2, max_order=10, m=12, seasonal=False, stationary=False,
information_criterion='aic', alpha=0.05, test='kpss', seasonal_test='ocsb', stepwise=False, n_jobs=1,
start_params=None, trend=None, method='lbfgs', maxiter=50, offset_test_args=None, seasonal_test_args=None,
suppress_warnings=True, error_action='warn', trace=False, random=False, random_state=20, n_fits=30,
return_valid_fits=False, out_of_sample_size=0, scoring='mse', scoring_args=None, with_intercept=True,
sarimax_kwargs=None)
# aic_value = model_auto_arima.fit(y_train,exog).aic()
aic_value = model_auto_arima.aic()
print(aic_value)
if aic_value < aic_best:
aic_best = aic_value
len_k = k
else:
pass