parent
6e6216ad67
commit
41227d1933
@ -51,11 +51,13 @@ is.null.handle <- function(handle) {
|
|||||||
# Return a verified to be valid handle out of either xgb.Booster.handle or xgb.Booster
|
# Return a verified to be valid handle out of either xgb.Booster.handle or xgb.Booster
|
||||||
# internal utility function
|
# internal utility function
|
||||||
xgb.get.handle <- function(object) {
|
xgb.get.handle <- function(object) {
|
||||||
handle <- switch(class(object)[1],
|
if (inherits(object, "xgb.Booster")) {
|
||||||
xgb.Booster = object$handle,
|
handle <- object$handle
|
||||||
xgb.Booster.handle = object,
|
} else if (inherits(object, "xgb.Booster.handle")) {
|
||||||
|
handle <- object
|
||||||
|
} else {
|
||||||
stop("argument must be of either xgb.Booster or xgb.Booster.handle class")
|
stop("argument must be of either xgb.Booster or xgb.Booster.handle class")
|
||||||
)
|
}
|
||||||
if (is.null.handle(handle)) {
|
if (is.null.handle(handle)) {
|
||||||
stop("invalid xgb.Booster.handle")
|
stop("invalid xgb.Booster.handle")
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user