0

我尝试在库的函数中使用early.stop.round参数,但是,我得到了一个错误。在我离开未指定后,该函数运行没有任何问题。我做错了什么?xgb.cvxgboostearly.stop.round

这是我的示例代码:

library(xgboost)

train = matrix(as.numeric(1:100),20,5)
Y = rep(c(0,1),10)
dtrain = xgb.DMatrix(train, label=Y)

#cross validation when early.stop.round =5, gives an error
CV = xgb.cv(data = dtrain, nround=200, nfold =2, metrics=list("auc"), 
            objective = "binary:logistic",early.stop.round = 5)


#cross validation when early.stop.round is not specified, works
CV = xgb.cv(data = dtrain, nround=200, nfold =2, metrics=list("auc"),
            objective = "binary:logistic")

我在用xgboost_0.4-2

4

1 回答 1

3

同时使用 metrics 参数和 early.stop 时似乎出了点问题。删除指标并使用 early.stop 和 eval_metric="auc" 代替。

于 2015-10-14T20:39:07.110 回答