This commit is contained in:
Vadim Khotilovich 2017-01-06 15:16:37 -06:00 committed by Tianqi Chen
parent d7406e07f3
commit 87e897f428

View File

@ -185,6 +185,8 @@ predict.xgb.Booster <- function(object, newdata, missing = NA,
newdata <- xgb.DMatrix(newdata, missing = missing) newdata <- xgb.DMatrix(newdata, missing = missing)
if (is.null(ntreelimit)) if (is.null(ntreelimit))
ntreelimit <- NVL(object$best_ntreelimit, 0) ntreelimit <- NVL(object$best_ntreelimit, 0)
if (NVL(object$params[['booster']], '') == 'gblinear')
ntreelimit <- 0
if (ntreelimit < 0) if (ntreelimit < 0)
stop("ntreelimit cannot be negative") stop("ntreelimit cannot be negative")