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

@@ -22,9 +22,7 @@ xgb.save <- function(model, fname) {
stop("xgb.save: fname must be character")
}
if (class(model) == "xgb.Booster") {
if (is.null(model$handle)) {
model$handle <- xgb.load(model$raw)
}
model <- xgb.Booster.check(model)
.Call("XGBoosterSaveModel_R", model$handle, fname, PACKAGE = "xgboost")
return(TRUE)
}