update doc, resolve warnings
This commit is contained in:
parent
47b5cf5148
commit
25f508e43e
@ -1,4 +1,3 @@
|
|||||||
setClass("xgb.Booster.handle")
|
|
||||||
setClass("xgb.Booster",
|
setClass("xgb.Booster",
|
||||||
slots = c(handle = "xgb.Booster.handle",
|
slots = c(handle = "xgb.Booster.handle",
|
||||||
raw = "raw"))
|
raw = "raw"))
|
||||||
|
|||||||
@ -1,5 +1,12 @@
|
|||||||
setClass("xgb.Booster.handle")
|
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",
|
setMethod("predict", signature = "xgb.Booster.handle",
|
||||||
definition = function(object, ...) {
|
definition = function(object, ...) {
|
||||||
if (class(object) != "xgb.Booster.handle"){
|
if (class(object) != "xgb.Booster.handle"){
|
||||||
@ -7,8 +14,6 @@ setMethod("predict", signature = "xgb.Booster.handle",
|
|||||||
}
|
}
|
||||||
|
|
||||||
bst <- xgb.handleToBooster(object)
|
bst <- xgb.handleToBooster(object)
|
||||||
# Avoid save a handle without update
|
|
||||||
# bst$raw <- xgb.save.raw(object)
|
|
||||||
|
|
||||||
ret = predict(bst, ...)
|
ret = predict(bst, ...)
|
||||||
return(ret)
|
return(ret)
|
||||||
|
|||||||
@ -17,12 +17,12 @@
|
|||||||
#' pred <- predict(bst, test$data)
|
#' pred <- predict(bst, test$data)
|
||||||
#' @export
|
#' @export
|
||||||
#'
|
#'
|
||||||
xgb.save.raw <- function(handle) {
|
xgb.save.raw <- function(model) {
|
||||||
if (class(handle) == "xgb.Booster"){
|
if (class(model) == "xgb.Booster"){
|
||||||
handle <- handle$handle
|
model <- model$handle
|
||||||
}
|
}
|
||||||
if (class(handle) == "xgb.Booster.handle") {
|
if (class(model) == "xgb.Booster.handle") {
|
||||||
raw <- .Call("XGBoosterModelToRaw_R", handle, PACKAGE = "xgboost")
|
raw <- .Call("XGBoosterModelToRaw_R", model, PACKAGE = "xgboost")
|
||||||
return(raw)
|
return(raw)
|
||||||
}
|
}
|
||||||
stop("xgb.raw: the input must be xgb.Booster.handle. Use xgb.DMatrix.save to save
|
stop("xgb.raw: the input must be xgb.Booster.handle. Use xgb.DMatrix.save to save
|
||||||
|
|||||||
18
R-package/man/predict-xgb.Booster.handle-method.Rd
Normal file
18
R-package/man/predict-xgb.Booster.handle-method.Rd
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
% Generated by roxygen2 (4.1.0): do not edit by hand
|
||||||
|
% Please edit documentation in R/predict.xgb.Booster.handle.R
|
||||||
|
\docType{methods}
|
||||||
|
\name{predict,xgb.Booster.handle-method}
|
||||||
|
\alias{predict,xgb.Booster.handle-method}
|
||||||
|
\title{Predict method for eXtreme Gradient Boosting model handle}
|
||||||
|
\usage{
|
||||||
|
\S4method{predict}{xgb.Booster.handle}(object, ...)
|
||||||
|
}
|
||||||
|
\arguments{
|
||||||
|
\item{object}{Object of class "xgb.Boost.handle"}
|
||||||
|
|
||||||
|
\item{...}{Parameters pass to \code{predict.xgb.Booster}}
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
Predicted values based on xgb.Booster.handle object.
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user