SHAP for Binary and Multiclass Target Variables
<p>SHAP values give the contribution of a model feature to a prediction. This is also true when we use SHAP for classification. Expect, for <strong>binary target variables, </strong>we interpret these values in terms of <strong>log odds</strong>. For <strong>multiclass targets</strong>, we use <strong>softmax</strong>. We will:</p>
<ul>
<li>Discuss these interpretations in more depth</li>
<li>Give the code for displaying SHAP plots for classification problems</li>
<li>Explore new ways of aggregating SHAP values for multiclass targets</li>
</ul>
<p>You can also watch this video on the topic:</p>
<p><iframe frameborder="0" height="480" scrolling="no" src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F2xlgOu22YgE%3Ffeature%3Doembed&display_name=YouTube&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D2xlgOu22YgE&image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F2xlgOu22YgE%2Fhqdefault.jpg&key=a19fcc184b9711e1b4764040d3dc5c07&type=text%2Fhtml&schema=youtube" title="SHAP for Binary and Multiclass Target Variables | Code and Explanations" width="854"></iframe></p>
<h1>Previous SHAP tutorial</h1>
<p>We continue on from a previous <a href="https://towardsdatascience.com/introduction-to-shap-with-python-d27edc23c454" rel="noopener" target="_blank">SHAP tutorial</a>. It goes into depth on SHAP plots for a continuous target variable. You will see that these plots and their insights are similar for categorical target variables. You can also find the full project on <a href="https://github.com/conorosully/SHAP-tutorial" rel="noopener ugc nofollow" target="_blank">GitHub</a>.</p>
<h2><a href="https://towardsdatascience.com/introduction-to-shap-with-python-d27edc23c454?source=post_page-----ff2f43de0cf4--------------------------------" rel="noopener follow" target="_blank">Introduction to SHAP with Python</a></h2>
<h3><a href="https://towardsdatascience.com/introduction-to-shap-with-python-d27edc23c454?source=post_page-----ff2f43de0cf4--------------------------------" rel="noopener follow" target="_blank">How to create and interpret SHAP plots: waterfall, force, mean SHAP, beeswarm and dependence</a></h3>
<p><a href="https://towardsdatascience.com/introduction-to-shap-with-python-d27edc23c454?source=post_page-----ff2f43de0cf4--------------------------------" rel="noopener follow" target="_blank">towardsdatascience.com</a></p>
<p>To summarise, we used SHAP to explain a model built using the <a href="https://archive.ics.uci.edu/ml/datasets/abalone" rel="noopener ugc nofollow" target="_blank">abalone dataset</a>. This has <strong>4,177</strong> instances and you can see examples of the features below. We use the <strong>8</strong> features to predict y — the number of <strong>rings </strong>in the abalone’s shell. The rings are related to the age of the abalone. In this tutorial, we will bin y into different groups to create binary and multiclass target variables.</p>
<p><a href="https://towardsdatascience.com/shap-for-binary-and-multiclass-target-variables-ff2f43de0cf4"><strong>Read More</strong></a></p>