Member-only story
Introduction to SHAP with Python
How to create and interpret SHAP plots: waterfall, force, mean SHAP, beeswarm and dependence
Updated: 12 March 2023
SHAP is the most powerful Python package for understanding and debugging your models. It can tell us how each model feature has contributed to an individual prediction. By aggregating SHAP values, we can also understand trends across multiple predictions. With a few lines of code, we are able to identify and visualise important relationships in our model.
We walk through the code used to calculate and display SHAP values. This includes explanations of the following SHAP plots:
- Waterfall plot
- Force plots
- Mean SHAP plot
- Beeswarm plot
- Dependence plots
We do this for a model that predicts a continuous target variable. If you want an explanation for classification, please see SHAP for Binary and Multiclass Target Variables. You can find the full project on GitHub.
There is also a video that goes over the content of this article. If you want more, check out my SHAP course. You can get free access if you sign up for my Newsletter :)