我尝试在gridSearchCV函数中使用arima模型,但它返回
“TypeError:无法克隆对象”(类型):它似乎不是scikit-learn估算器,因为它没有实现'get_params'方法。 “
import numpy as np
import pandas as pd
from sklearn.grid_search import GridSearchCV
from statsmodels.tsa.arima_model import ARIMA
df_original = pd.DataFrame({"date_col": ['2016-08-01', '2016-08-02', '2016-08-03', '2016-08-04', '2016-08-05',
'2016-08-06', '2016-08-07', '2016-08-08', '2016-08-09', '2016-08-10',
'2016-08-11'],
'sum_base_revenue_cip': [1, 2, 7, 5, 1, 2, 5, 10, 9, 0, 1]})
df_original["sum_base_revenue_cip"] = np.log(df_original["sum_base_revenue_cip"] + 1e-6)
df_original_ts = df_original.copy(deep=True)
df_original_ts['date_col'] = pd.to_datetime(df_original['date_col'])
df_original_ts = df_original_ts.set_index('date_col')
print df_original_ts
estimator = ARIMA(df_original_ts,order=(1,1,0))
params = {
'order': ((2, 1, 0), (0, 2, 1), (1, 0, 0))
}
grid_search = GridSearchCV(estimator,
params,
n_jobs=-1,
verbose=True)
grid_search.fit(df_original_ts)
答案 0 :(得分:0)