[R] Use built-in label when xgb.DMatrix is given to xgb.cv() (#4631)

* Use built-in label when xgb.DMatrix is given to xgb.cv()

* Add a test

* Fix test

* Bump version number
This commit is contained in:
Philip Hyunsu Cho
2019-07-03 01:32:40 -07:00
committed by GitHub
parent 986fee6022
commit 4e9fad74eb
4 changed files with 27 additions and 5 deletions

View File

@@ -285,7 +285,8 @@ test_that("prediction in early-stopping xgb.cv works", {
set.seed(11)
expect_output(
cv <- xgb.cv(param, dtrain, nfold = 5, eta = 0.1, nrounds = 20,
early_stopping_rounds = 5, maximize = FALSE, prediction = TRUE)
early_stopping_rounds = 5, maximize = FALSE, stratified = FALSE,
prediction = TRUE)
, "Stopping. Best iteration")
expect_false(is.null(cv$best_iteration))