R/SHAP_funcs.R
shap.importance.Rd
Variable importance as measured by mean absolute SHAP value.
shap.importance(data_long, names_only = FALSE, top_n = Inf)
data_long | a long format data of SHAP values from
|
---|---|
names_only | If |
top_n | How many variables to be returned? |
returns data.table
with average absolute SHAP
values per variable, sorted in decreasing order of importance.
shap.importance(shap_long_iris)#> variable mean_abs_shap #> 1: Petal.Length 0.62935975 #> 2: Petal.Width 0.21664035 #> 3: Sepal.Length 0.02910357 #> 4: Sepal.Width 0.00000000shap.importance(shap_long_iris, names_only = 1)#> variable mean_abs_shap #> 1: Petal.Length 0.62935975 #> 2: Petal.Width 0.21664035 #> 3: Sepal.Length 0.02910357 #> 4: Sepal.Width 0.00000000