Fix CV which was monitoring train-metric

https://github.com/dmlc/xgboost/issues/807
This commit is contained in:
Florian 2016-02-15 12:00:35 +01:00
parent 70d9732765
commit 2443cb9ca8

View File

@ -191,7 +191,7 @@ xgb.cv <- function(params=list(), data, nrounds, nfold, label = NULL, missing =
# early_Stopping
if (!is.null(early.stop.round)){
score <- strsplit(ret,'\\s+')[[1]][2 + length(metrics)]
score <- strsplit(ret,'\\s+')[[1]][1 + length(metrics) + 2]
score <- strsplit(score,'\\+|:')[[1]][[2]]
score <- as.numeric(score)
if ( (maximize && score > bestScore) || (!maximize && score < bestScore)) {