如何优化傅立叶级数中 'k' 的最佳值
how to optimize the best value for 'k' in FourierSeries
我正在尝试使用 pmdarima 包中的 autoARIMA 预测 700 种不同的产品。
对于季节性,傅里叶级数使它更容易,因为所有产品模式都不同。
但是,我如何根据循环中的产品select "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))])
求推荐。谢谢。
下面是为使用最小 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
我正在尝试使用 pmdarima 包中的 autoARIMA 预测 700 种不同的产品。 对于季节性,傅里叶级数使它更容易,因为所有产品模式都不同。
但是,我如何根据循环中的产品select "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))])
求推荐。谢谢。
下面是为使用最小 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