SHapley Additive exPlanations (SHAP) algorithm is a method to explain individual predictions (feature contributions) for a machine learning model based on the cooperative game theory. SHAP computes the contribution of each feature in a prediction as as average marginal contribution of the feature value across all possible coalitions. TD_SHAP also computes mean absolute contribution of each feature as global explanation (using OUT clause) which can be used as a measure of feature importance.
TD_SHAP supports the regression and classification models of the following functions:
- TD_GLM
- TD_DecisionForest
- TD_XGBoost
For Tree-based methods, SHAP computation is quite intensive and therefore should be run on a small subset of prediction dataset. TD_SHAP needs an input table and a model table to output the feature contribution based on Shapley values.
The following is an example of how to use TD_SHAP:
- Prepare training dataset to be used for building a classification or regression model.
- Generate model using the training dataset. The supported functions are: TD_GLM, TD_DecisionForest, and TD_XGBoost.
- Prepare test dataset to be used for prediction/evaluating the model for SHAP contributions.
- Generate SHAP contributions on test dataset using TD_SHAP function.