add handle and raw structure to xgb.Booster

This commit is contained in:
hetong007
2015-02-09 15:51:24 -08:00
parent ea5860d574
commit 5b611c355e
7 changed files with 46 additions and 16 deletions

View File

@@ -17,11 +17,11 @@
#' pred <- predict(bst, test$data)
#' @export
#'
xgb.save.raw <- function(model) {
if (class(model) == "xgb.Booster") {
raw <- .Call("XGBoosterModelToRaw_R", model, PACKAGE = "xgboost")
xgb.save.raw <- function(handle) {
if (class(handle) == "xgb.Booster.handle") {
raw <- .Call("XGBoosterModelToRaw_R", handle, PACKAGE = "xgboost")
return(raw)
}
stop("xgb.raw: the input must be xgb.Booster. Use xgb.DMatrix.save to save
stop("xgb.raw: the input must be xgb.Booster.handle. Use xgb.DMatrix.save to save
xgb.DMatrix object.")
}