我想知道下面的设置是否正确,以便使用CARET的xgbDART方法从模型生成SHAP值。在此特定情况下的问题是SHAP值rowSums()
不会累加预测分数。任何方向都将非常有帮助。这是我的设置:
#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
)