0

我尝试在 pmdarima 包中使用 autoARIMA 预测 700 种不同的产品。对于季节性,傅里叶级数更容易,因为所有产品的模式都不同。

但是,如何根据循环中的产品选择不同的“k”值。是否有任何测试或优化功能可以这样做?

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))])

请建议。谢谢你。

4

1 回答 1

0

下面是为使用最小 AIC 获得傅立叶变换的 K 值而创建的循环。我的数据是月频。这个对我有用。

 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
于 2020-05-30T20:26:42.727 回答