dmlc / dmlc/xgboost

`predict.xgboost` silently ignores `predcontrib = T`

Open
#12,211 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
28.8k
Forks
8.9k
Avg merge
1d 12h
Merged PRs (30d)
54

Description

With `xgboost` 3.2.1.1:

```R
m = xgboost::xgboost(
x = mtcars[, c("cyl", "disp", "hp")],
y = mtcars$mpg)
str(predict(m,
mtcars[, c("cyl", "disp", "hp")],
predcontrib = T))
# Named num [1:32] 21 21 22.8 21.4 18.7 ...
# - attr(*, "names")= chr [1:32] "Mazda RX4" "Mazda RX4 Wag" "Datsun 710" "Hornet 4 Drive" ...
```

What the user should do is say `type = "contrib"`, because XGBoost's two `predict` methods have inconsistent interfaces for this. But it's hard to catch what's going on because `predict.xgboost` produces no warning or error for unrecognized parameters, and `predcontrib = T` used to work in this context in previous versions of XGBoost.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by examining the R `predict.xgboost` implementation and how it handles unrecognized prediction parameters, then compare its interface with the other `predict` method. Reproduce the `predcontrib = T` example and verify that the completed behavior either reports the unsupported argument clearly or preserves the previously supported usage.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.