Learn R Programming

vip (version 0.3.2)

vi_shap: SHAP-based variable importance

Description

Compute SHAP-based VI scores for the predictors in a model. See details below.

Usage

vi_shap(object, ...)

# S3 method for default vi_shap(object, feature_names = NULL, train = NULL, ...)

Value

A tidy data frame (i.e., a "tibble" object) with two columns, Variable and Importance, containing the variable name and its associated importance score, respectively.

Arguments

object

A fitted model object (e.g., a "randomForest" object).

...

Additional optional arguments to be passed on to explain.

feature_names

Character string giving the names of the predictor variables (i.e., features) of interest. If NULL (the default) then the internal `get_feature_names()` function will be called to try and extract them automatically. It is good practice to always specify this argument.

train

A matrix-like R object (e.g., a data frame or matrix) containing the training data. If NULL (the default) then the internal `get_training_data()` function will be called to try and extract it automatically. It is good practice to always specify this argument.

Details

This approach to computing VI scores is based on the mean absolute value of the SHAP values for each feature; see, for example, https://github.com/slundberg/shap and the references therein.

Strumbelj, E., and Kononenko, I. Explaining prediction models and individual predictions with feature contributions. Knowledge and information systems 41.3 (2014): 647-665.