Prints formatted results of xgb.cv
.
# S3 method for xgb.cv.synchronous print(x, verbose = FALSE, ...)
x | an |
---|---|
verbose | whether to print detailed data |
... | passed to |
When not verbose, it would only print the evaluation results, including the best iteration (when available).
data(agaricus.train, package='xgboost') train <- agaricus.train cv <- xgb.cv(data = train$data, label = train$label, nfold = 5, max_depth = 2, eta = 1, nthread = 2, nrounds = 2, objective = "binary:logistic")#> [1] train-error:0.050745+0.010070 test-error:0.055427+0.011840 #> [2] train-error:0.021304+0.001085 test-error:0.021190+0.006326print(cv)#> ##### xgb.cv 5-folds #> iter train_error_mean train_error_std test_error_mean test_error_std #> 1 0.0507450 0.010069865 0.0554268 0.011840484 #> 2 0.0213036 0.001085482 0.0211898 0.006326296#> ##### xgb.cv 5-folds #> call: #> xgb.cv(data = train$data, nrounds = 2, nfold = 5, label = train$label, #> max_depth = 2, eta = 1, nthread = 2, objective = "binary:logistic") #> params (as set within xgb.cv): #> max_depth = "2", eta = "1", nthread = "2", objective = "binary:logistic", silent = "1" #> callbacks: #> cb.print.evaluation(period = print_every_n, showsd = showsd) #> cb.evaluation.log() #> niter: 2 #> evaluation_log: #> iter train_error_mean train_error_std test_error_mean test_error_std #> 1 0.0507450 0.010069865 0.0554268 0.011840484 #> 2 0.0213036 0.001085482 0.0211898 0.006326296