add dump statistics
This commit is contained in:
@@ -10,6 +10,10 @@
|
||||
#' See demo/ for walkthrough example in R, and
|
||||
#' \url{https://github.com/tqchen/xgboost/blob/master/demo/data/featmap.txt}
|
||||
#' for example Format.
|
||||
#' @param with.stats whether dump statistics of splits
|
||||
#' When this option is on, the model dump comes with two additional statistics:
|
||||
#' gain is the approximate loss function gain we get in each split;
|
||||
#' cover is the sum of second order gradient in each node.
|
||||
#'
|
||||
#' @examples
|
||||
#' data(agaricus.train, package='xgboost')
|
||||
@@ -21,13 +25,13 @@
|
||||
#' xgb.dump(bst, 'xgb.model.dump')
|
||||
#' @export
|
||||
#'
|
||||
xgb.dump <- function(model, fname, fmap = "") {
|
||||
xgb.dump <- function(model, fname, fmap = "", with.stats=FALSE) {
|
||||
if (class(model) != "xgb.Booster") {
|
||||
stop("xgb.dump: first argument must be type xgb.Booster")
|
||||
}
|
||||
if (typeof(fname) != "character") {
|
||||
stop("xgb.dump: second argument must be type character")
|
||||
}
|
||||
.Call("XGBoosterDumpModel_R", model, fname, fmap, PACKAGE = "xgboost")
|
||||
.Call("XGBoosterDumpModel_R", model, fname, fmap, as.integer(with.stats), PACKAGE = "xgboost")
|
||||
return(TRUE)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user