Update xgb.cv.R
This commit is contained in:
parent
704d9e0a13
commit
48e19c1964
@ -216,7 +216,11 @@ xgb.cv <- function(params=list(), data, nrounds, nfold, label = NULL, missing =
|
|||||||
if (prediction) {
|
if (prediction) {
|
||||||
for (k in 1:nfold) {
|
for (k in 1:nfold) {
|
||||||
fd = xgb_folds[[k]]
|
fd = xgb_folds[[k]]
|
||||||
res = xgb.iter.eval(fd$booster, fd$watchlist, i - 1, feval, prediction)
|
if (!is.null(early.stop.round) && earlyStopflag) {
|
||||||
|
res = xgb.iter.eval(fd$booster, fd$watchlist, bestInd - 1, feval, prediction)
|
||||||
|
} else {
|
||||||
|
res = xgb.iter.eval(fd$booster, fd$watchlist, nrounds - 1, feval, prediction)
|
||||||
|
}
|
||||||
if (mat_pred) {
|
if (mat_pred) {
|
||||||
pred_mat = matrix(res[[2]],num_class,length(fd$index))
|
pred_mat = matrix(res[[2]],num_class,length(fd$index))
|
||||||
predictValues[fd$index,] = t(pred_mat)
|
predictValues[fd$index,] = t(pred_mat)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user