diff --git a/R-package/R/utils.R b/R-package/R/utils.R index 008a88dcd715..79ede367519c 100644 --- a/R-package/R/utils.R +++ b/R-package/R/utils.R @@ -285,7 +285,7 @@ generate.cv.folds <- function(nfold, nrows, stratified, label, group, params) { return(generate.group.folds(nfold, group)) } objective <- params$objective - if (!is.character(objective)) { + if (stratified && !is.character(objective)) { warning("Will use unstratified splitting (custom objective used)") stratified <- FALSE }