1

I am performing cross-validation with xgboost in R. I have a Windows 10 system and am using 3.3.2. For some of my runs, a number of iterations are required before my early stop requirement has been met. So, I wish reduce the number of lines spit out in the console.

I have tried silent=1 which does nothing to silence the output in the console, verbose_eval=50 which does nothing to limit the output in the console and lastly verbose_eval=False which gives the following error message and halts termination:

Error in check.deprecation(...) : object 'False' not found

I suppose the last one may only be valid in Python and that might be the source of the error. Still, the other two methods I try do not reduce the output to the console.

My code to show how I am applying these:

for (eta in seq(0,1,0.1)) {
    param <- list(objective = "reg:linear", val_metric = "rmse", eta = eta, booster = "dart")
    mdcv <- xgb.cv(param = param, data = sapply(train[1:80], as.numeric),   label = as.numeric(unlist(train[81])), verbose_eval=50, nfold = 10, nrounds = 30000, early_stopping_rounds = 8)
    min_rmse <- mdcv[[4]][mdcv$best_iteration]$test_rmse_mean
    print(paste(eta, ' ', min_rmse))
}
demongolem
  • 9,474
  • 36
  • 90
  • 105
  • This is a typo. Use FALSE not False. I make the opposite typo often in python. – lmo Dec 29 '16 at 19:02
  • @lmo Ah yes, I see. So, my error disappears, but I am left with similar behavior as the other two options I give. My output is in no way limited inside the console. – demongolem Dec 29 '16 at 19:04
  • I don't have access to this package at the moment to look at the options, but you could try wrapping the function in `suppressMessages`. – lmo Dec 29 '16 at 19:09
  • @lmo If I do `suppressMessages(library(xgboost))` before the code above, still nothing. I read at http://stackoverflow.com/questions/8681688/disable-messages-upon-loading-package-in-r that it does not suppress `cat()`, but I don't know if that is applicable in this case – demongolem Dec 29 '16 at 19:18
  • Also, I know I could try to use `sink()` and put it to file, but I want to try to figure out why everything is still going to console. – demongolem Dec 29 '16 at 19:19

0 Answers0