为什么 xgboost 中的 early.stop.round 参数不起作用?
Why doesnt the early.stop.round argument in xgboost work?
我尝试在 xgboost
库的 xgb.cv
函数中使用 early.stop.round
参数,但是,我得到了一个错误。在我未指定 early.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
同时使用 metrics 参数和 early.stop 时似乎出了点问题。删除指标并使用 early.stop 和 eval_metric="auc" 代替。
我尝试在 xgboost
库的 xgb.cv
函数中使用 early.stop.round
参数,但是,我得到了一个错误。在我未指定 early.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
同时使用 metrics 参数和 early.stop 时似乎出了点问题。删除指标并使用 early.stop 和 eval_metric="auc" 代替。