Intro.
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 (see papers for details and citations).
This article will introduce SHAP installation and simple examples.
Installation
SHAP is a Python package, we need to install python first. in data science related analysis, we often use anaconda this python distribution, which provides some basic packages and management environment.
Follow the Link step by step to complete the anaconda installation.
Open anaconda prompt and execute the command below to install SHAP package and interactive browser controls for jupyter notebook.
1
2conda install -c conda-forge matplotlib
conda install -c conda-forge shapNow you can use SHAP in python IDE like Jupyter Notebook (Anaconda built-in)
Example
You can obtain the full example file from Link
The example dataset is obtained from Link