bugfix booster.check

This commit is contained in:
tqchen
2015-03-26 16:43:01 -07:00
parent 23e46b7fa5
commit 98618646f6
3 changed files with 15 additions and 2 deletions

View File

@@ -87,8 +87,12 @@ xgb.handleToBooster <- function(handle)
# Check whether an xgb.Booster object is complete
xgb.Booster.check <- function(bst, saveraw = TRUE)
{
if (is.null(bst$handle)) {
bst$handle <- xgb.load(bst$raw)
isnull <- is.null(bst$handle)
if (!isnull) {
isnull <- .Call("XGCheckNullPtr_R", bst$handle, PACKAGE="xgboost")
}
if (isnull) {
bst$handle <- xgb.Booster(modelfile = bst$raw)
} else {
if (is.null(bst$raw) && saveraw)
bst$raw <- xgb.save.raw(bst$handle)