Fixed off by 1 bug in xgb.cv

This commit is contained in:
Ganesh 2016-01-07 22:20:21 -08:00
parent 0958fb35ae
commit 6ba53329e5

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]][1 + length(metrics) + 2]
score <- strsplit(ret,'\\s+')[[1]][2 + length(metrics)]
score <- strsplit(score,'\\+|:')[[1]][[2]]
score <- as.numeric(score)
if ( (maximize && score > bestScore) || (!maximize && score < bestScore)) {