我正在尝试使用带有xgboost的R调查我的模型.一般来说训练模型运作良好,但是考虑到它是度量的一些问题.
我试图为类列设置一个因子,但仍然没有结果.
我的数据
ID var1var2TARGET
1 5 0 1
2 4 3 1
3 4 2 0
4 3 1 0
5 2 4 1
6 1 2 1
7 5 3 1
8 4 1 0
9 4 1 0
10 2 4 1
11 5 5 1
Run Code Online (Sandbox Code Playgroud)
为此我做
train <- read.csv()
train.y <- train$TARGET
train$TARGET <- NULL
train$ID <- NULL
train.y <- lapply(train.y, factor)
Run Code Online (Sandbox Code Playgroud)
然后我准备模型参数
xgb_grid_1 = expand.grid(
nrounds = 1000,
eta = c(0.01, 0.001, 0.0001),
max_depth = …Run Code Online (Sandbox Code Playgroud) 我已经开始学习statsmodels包,无法用arima实现基本的预测.
错误是
ValueError:给定一个pandas对象,索引不包含日期
我正在尝试这个版本:
df = make_df(filename_data)
y = []
x = []
# here I am preparing day by day sequence as that I have inconsistent data and I set 0 to NAN values
start_date = df[date_col].min()
end_date = df[date_col].max()
while start_date <= end_date:
x.append(start_date)
try:
y.append(
df[df[date_col] == start_date][rev_col].values[0])
except:
y.append(0)
start_date += datetime.timedelta(days=1)
y = np.array(y)
x = np.array(x)
y = pd.TimeSeries(y, index=x)
print(y)
arma_mod = sm.tsa.ARMA(y, order=(2,2))
arma_res = arma_mod.fit(trend='nc', disp=-1)
Run Code Online (Sandbox Code Playgroud)
在此之前我尝试过
df = make_df(filename_data)
y …Run Code Online (Sandbox Code Playgroud)