fix segfault and add two function for handle and booster

This commit is contained in:
hetong007
2015-02-09 17:28:48 -08:00
parent 0aef62dabc
commit 4c25600d2a
7 changed files with 32 additions and 26 deletions

View File

@@ -41,12 +41,7 @@ xgb.dump <- function(model = NULL, fname = NULL, fmap = "", with.stats=FALSE) {
if (class(model) != "xgb.Booster") {
stop("model: argument must be type xgb.Booster")
} else {
if (is.null(model$handle)) {
model$handle <- xgb.load(model$raw)
} else {
if (is.null(model$raw))
model$raw <- xgb.save.raw(model$handle)
}
model <- xgb.Booster.check(model)
}
if (!(class(fname) %in% c("character", "NULL") && length(fname) <= 1)) {
stop("fname: argument must be type character (when provided)")