From 91429bd63d00fd090d9b74ddf8cdae9af6a5ebed Mon Sep 17 00:00:00 2001 From: Groves Date: Thu, 3 Dec 2015 06:40:11 -0600 Subject: [PATCH] Expose model parameters to R --- R-package/R/xgb.train.R | 5 +++++ 1 file changed, 5 insertions(+) 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) }