update doc, resolve warnings
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
setClass("xgb.Booster.handle")
|
||||
setClass("xgb.Booster",
|
||||
slots = c(handle = "xgb.Booster.handle",
|
||||
raw = "raw"))
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
setClass("xgb.Booster.handle")
|
||||
|
||||
#' Predict method for eXtreme Gradient Boosting model handle
|
||||
#'
|
||||
#' Predicted values based on xgb.Booster.handle object.
|
||||
#'
|
||||
#' @param object Object of class "xgb.Boost.handle"
|
||||
#' @param ... Parameters pass to \code{predict.xgb.Booster}
|
||||
#'
|
||||
setMethod("predict", signature = "xgb.Booster.handle",
|
||||
definition = function(object, ...) {
|
||||
if (class(object) != "xgb.Booster.handle"){
|
||||
@@ -7,8 +14,6 @@ setMethod("predict", signature = "xgb.Booster.handle",
|
||||
}
|
||||
|
||||
bst <- xgb.handleToBooster(object)
|
||||
# Avoid save a handle without update
|
||||
# bst$raw <- xgb.save.raw(object)
|
||||
|
||||
ret = predict(bst, ...)
|
||||
return(ret)
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
#' pred <- predict(bst, test$data)
|
||||
#' @export
|
||||
#'
|
||||
xgb.save.raw <- function(handle) {
|
||||
if (class(handle) == "xgb.Booster"){
|
||||
handle <- handle$handle
|
||||
xgb.save.raw <- function(model) {
|
||||
if (class(model) == "xgb.Booster"){
|
||||
model <- model$handle
|
||||
}
|
||||
if (class(handle) == "xgb.Booster.handle") {
|
||||
raw <- .Call("XGBoosterModelToRaw_R", handle, PACKAGE = "xgboost")
|
||||
if (class(model) == "xgb.Booster.handle") {
|
||||
raw <- .Call("XGBoosterModelToRaw_R", model, PACKAGE = "xgboost")
|
||||
return(raw)
|
||||
}
|
||||
stop("xgb.raw: the input must be xgb.Booster.handle. Use xgb.DMatrix.save to save
|
||||
|
||||
Reference in New Issue
Block a user