Skip to content

Commit

Permalink
[R] Fix threads used to create DMatrix in predict. (#8681) (#8682)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis authored Jan 14, 2023
1 parent 021e6a8 commit 76bdca0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R-package/R/xgb.Booster.R
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,9 @@ predict.xgb.Booster <- function(object, newdata, missing = NA, outputmargin = FA
predleaf = FALSE, predcontrib = FALSE, approxcontrib = FALSE, predinteraction = FALSE,
reshape = FALSE, training = FALSE, iterationrange = NULL, strict_shape = FALSE, ...) {
object <- xgb.Booster.complete(object, saveraw = FALSE)

if (!inherits(newdata, "xgb.DMatrix"))
newdata <- xgb.DMatrix(newdata, missing = missing)
newdata <- xgb.DMatrix(newdata, missing = missing, nthread = NVL(object$params[["nthread"]], -1))
if (!is.null(object[["feature_names"]]) &&
!is.null(colnames(newdata)) &&
!identical(object[["feature_names"]], colnames(newdata)))
Expand Down

0 comments on commit 76bdca0

Please sign in to comment.