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

@@ -20,9 +20,8 @@ xgb.load <- function(modelfile) {
if (is.null(modelfile))
stop("xgb.load: modelfile cannot be NULL")
bst <- list(handle = NULL,raw = NULL)
class(bst) <- 'xgb.Booster'
bst$handle <- xgb.Booster(modelfile = modelfile)
bst$raw <- xgb.save.raw(bst$handle)
handle <- xgb.Booster(modelfile = modelfile)
bst <- xgb.handleToBooster(handle)
bst <- xgb.Booster.check(bst)
return(bst)
}