Permalink
Browse files

[R] fix #1903 (#1929)

1 parent d7406e0 commit 87e897f428c069904fd7183b69ed75fce67e1b6c @khotilov khotilov committed with tqchen Jan 6, 2017
Showing with 2 additions and 0 deletions.
  1. +2 −0 R-package/R/xgb.Booster.R
@@ -185,6 +185,8 @@ predict.xgb.Booster <- function(object, newdata, missing = NA,
newdata <- xgb.DMatrix(newdata, missing = missing)
if (is.null(ntreelimit))
ntreelimit <- NVL(object$best_ntreelimit, 0)
+ if (NVL(object$params[['booster']], '') == 'gblinear')
+ ntreelimit <- 0
if (ntreelimit < 0)
stop("ntreelimit cannot be negative")

0 comments on commit 87e897f

Please sign in to comment.