Expose model parameters to R

This commit is contained in:
Groves 2015-12-03 06:40:11 -06:00
parent 5473994a42
commit 91429bd63d

View File

@ -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') warning('watchlist is provided but verbose=0, no evaluation information will be printed')
} }
fit.call <- match.call()
dot.params <- list(...) dot.params <- list(...)
nms.params <- names(params) nms.params <- names(params)
nms.dot.params <- names(dot.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) bst <- xgb.Booster.check(bst)
if (!is.null(early.stop.round)) { if (!is.null(early.stop.round)) {
bst$bestScore <- bestScore bst$bestScore <- bestScore
bst$bestInd <- bestInd bst$bestInd <- bestInd
} }
attr(bst, "call") <- fit.call
attr(bst, "params") <- params
return(bst) return(bst)
} }