dmlc / dmlc/xgboost

xgb.plot.shap failed when not providing model

Open
#9,961 0 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

Hi, I changed the example in help a little, found that not work.
Can someone bring me a clue what happened?

```
data(agaricus.train, package='xgboost')
data(agaricus.test, package='xgboost')
bst <- xgboost(agaricus.train$data, agaricus.train$label, nrounds = 50,
eta = 0.1, max_depth = 3, subsample = .5,
method = "hist", objective = "binary:logistic", nthread = 2, verbose = 0)
contr <- predict(bst, agaricus.test$data, predcontrib = TRUE)
#Since the last col of contr is NOT included in original date, I didn't pick it.
xgb.plot.shap(agaricus.test$data, contr, features = colnames(contr)[1:(ncol(contr)-1)], top_n = 12, n_col = 3)

```

but this failed

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the provided R example for xgb.plot.shap and capture the exact failure, since the issue does not include an error message. Trace the xgb.plot.shap entry point and determine how the shown call without a model is handled; done means the documented example runs successfully or the required usage is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.