Update predict.xgb.Booster.R
add parameter missing
This commit is contained in:
parent
98ee7e8057
commit
c16e0f6809
@ -25,9 +25,13 @@ setClass("xgb.Booster")
|
|||||||
#' @export
|
#' @export
|
||||||
#'
|
#'
|
||||||
setMethod("predict", signature = "xgb.Booster",
|
setMethod("predict", signature = "xgb.Booster",
|
||||||
definition = function(object, newdata, outputmargin = FALSE, ntreelimit = NULL) {
|
definition = function(object, newdata, missing = NULL, outputmargin = FALSE, ntreelimit = NULL) {
|
||||||
if (class(newdata) != "xgb.DMatrix") {
|
if (class(newdata) != "xgb.DMatrix") {
|
||||||
|
if (is.null(missing)) {
|
||||||
newdata <- xgb.DMatrix(newdata)
|
newdata <- xgb.DMatrix(newdata)
|
||||||
|
} else {
|
||||||
|
newdata <- xgb.DMatrix(newdata, missing = missing)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (is.null(ntreelimit)) {
|
if (is.null(ntreelimit)) {
|
||||||
ntreelimit <- 0
|
ntreelimit <- 0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user