I was wondering if my following setup is correct to generate SHAP values from a model using CARET's xgbDART method. The problem in this particular case is that SHAP values rowSums()
doesnt add up to the predicted score. Any direction would be very helpful. Here is my setup:
#model scores
set.seed(200)
pred_mod<- predict(xgb_05_v6$finalModel,
newdata= as.matrix(X1),
ntreelimit = param_dart$nrounds,
objective = "binary:logistic",
outputmargin = TRUE
)
#SHAP values
set.seed(200)
SHAP_contribution<- predict(xgb_05_v6$finalModel,
newdata= as.matrix(X1),
ntreelimit = param_dart$nrounds,
objective = "binary:logistic",
approxcontrib = FALSE,
predcontrib = TRUE
)