diff --git a/R-package/R/xgb.train.R b/R-package/R/xgb.train.R index 768bed27b..d7fa6e1ee 100644 --- a/R-package/R/xgb.train.R +++ b/R-package/R/xgb.train.R @@ -140,6 +140,7 @@ xgb.train <- function(params=list(), data, nrounds, watchlist = list(), warning('watchlist is provided but verbose=0, no evaluation information will be printed') } + fit.call <- match.call() dot.params <- list(...) nms.params <- names(params) nms.dot.params <- names(dot.params) @@ -224,9 +225,13 @@ xgb.train <- function(params=list(), data, nrounds, watchlist = list(), } } bst <- xgb.Booster.check(bst) + if (!is.null(early.stop.round)) { bst$bestScore <- bestScore bst$bestInd <- bestInd } + + attr(bst, "call") <- fit.call + attr(bst, "params") <- params return(bst) }