SHAP (SHapley Additive exPlanations) is a game theoretic approach to explain the output of any machine learning model. It connects optimal credit allocation with local explanations using the classic Shapley values from game theory and their related extensions. While SHAP can explain the output of any machine learning model, we have developed a high-speed exact algorithm for tree ensemble methods. Fast C++ implementations are supported for XGBoost, LightGBM, CatBoost, scikit-learn and pyspark tree models. To understand how a single feature effects the output of the model we can plot the SHAP value of that feature vs. the value of the feature for all the examples in a dataset. Since SHAP values represent a feature's responsibility for a change in the model output, the plot below represents the change in predicted house price as RM (the average number of rooms per house in an area) changes.
Features
- SHAP can be installed from either PyPI or conda-forge
- Take the mean absolute value of the SHAP values for each feature to get a standard bar plot
- Natural language examples (transformers)
- SHAP has specific support for natural language models
- Deep learning examples with DeepExplainer
- Deep SHAP is a high-speed approximation algorithm for SHAP values in deep learning models