add documentation notes
This commit is contained in:
@@ -1,11 +1,23 @@
|
||||
# dump model
|
||||
xgb.dump <- function(booster, fname, fmap = "") {
|
||||
if (class(booster) != "xgb.Booster") {
|
||||
#' Save xgboost model to text file
|
||||
#'
|
||||
#' Save a xgboost model to text file. Could be parsed later.
|
||||
#'
|
||||
#' @param model the model object.
|
||||
#' @param fname the name of the binary file.
|
||||
#' @param fmap TODO(tqchen)
|
||||
#'
|
||||
#' @examples
|
||||
#' data(iris)
|
||||
#' bst <- xgboost(as.matrix(iris[,1:4]),as.numeric(iris[,5]), nrounds = 2)
|
||||
#' xgb.dump(bst, 'iris.xgb.model.dump')
|
||||
#'
|
||||
xgb.dump <- function(model, fname, fmap = "") {
|
||||
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", booster, fname, fmap, PACKAGE = "xgboost")
|
||||
.Call("XGBoosterDumpModel_R", model, fname, fmap, PACKAGE = "xgboost")
|
||||
return(TRUE)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user