plot and summarize shapley values from an xgboost model
tidy_shap(model, newdata, form = NULL, ..., top_n = 12, aggregate = NULL)
xgboost model
dataframe similar to model input
formula used for model
additional parameters for shapley value
top n features
a character vector. Predictors containing the string will be aggregated, and renamed to that string.
list
returns a list with the following entries
: table of shaply values
: table summarizing shapley values. Includes correlation between shaps and feature values.
: one plot showing the relation between shaps and features
: returns the top 9 most important features as determined by sum of absolute shapley values, as a facetted scatterplot of feature vs shap