Hello,
When I try using the xgb.shap.data function in R I receive the following error message:
Error in xgb.shap.data(bstSparse) : could not find function “xgb.shap.data”
I have tried this with both simple and complex xgb models and I get the same error. I am running the latest version of R (4.1.2) through RStudio on a Windows 10 (64 bit) machine, and I just updated my version of xgboost to 1.5.0.2. Here’s a simple (hopefully, reproduceable) example of the error:
data(agaricus.train, package=‘xgboost’)
data(agaricus.test, package=‘xgboost’)
train <- agaricus.train
test <- agaricus.test
bstSparse <- xgboost(data = train$data,
label = train$label,
max_depth = 2,
eta = 1,
nthread = 2,
nrounds = 2,
objective = “binary:logistic”,
eval_metric = “logloss”
)
xgb.shap.data(bstSparse)
Error in xgb.shap.data(bstSparse) :
could not find function “xgb.shap.data”
Any help resolving this working would be much appreciated!