tidy_shap {autostats}R Documentation

tidy shap

Description

plot and summarize shapley values from an xgboost model

Usage

tidy_shap(model, newdata, form = NULL, ..., top_n = 12, aggregate = NULL)

Arguments

model

xgboost model

newdata

dataframe similar to model input

form

formula used for model

...

additional parameters for shapley value

top_n

top n features

aggregate

a character vector. Predictors containing the string will be aggregated, and renamed to that string.

Details

returns a list with the following entries

shap_tbl

: table of shaply values

shap_summary

: table summarizing shapley values. Includes correlation between shaps and feature values.

swarmplot

: one plot showing the relation between shaps and features

scatterplots

: returns the top 9 most important features as determined by sum of absolute shapley values, as a facetted scatterplot of feature vs shap

Value

list


[Package autostats version 0.4.0 Index]