I would like to know if there is a method to compute global feature importance in R package of XGBoost using SHAP values instead of GAIN like Python package of SHAP. I mean, in XGBoost for Python there is a function to compute SHAP values at global level making the mean absolute of the SHAP value for each feature.
You can do:
shap_contrib <- predict(model,newdata,predcontrib=T)
in order to get the SHAP
values directly from XGBoost
.
Once you get that, it's just a matter of doing:
mean_shap <- colMeans(abs(shap_contrib))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.