You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/_build/html/_sources/guides/explain/shap.rst.txt
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,14 +30,14 @@ where :math:`g` is the explanation method, :math:`p` is the number of features,
30
30
31
31
Exact Solution
32
32
""""""""""""""""""""""""""""
33
-
The exact solution is obtained using the Shapley value formula, which requires evaluating all possible coalitions of features with and without the :math:`j`-th feature.
33
+
The exact solution is obtained using the Shapley value formula, which requires evaluating all possible coalitions of features with and without the :math:`i`-th feature.
where :math:`val` is the value function that returns the prediction of each coalition. The marginal contribution of feature :math:`j` to the coalition :math:`S` is calculated as the difference between the value of the coalition with the addition of feature :math:`j` and the value of the original coalition, i.e., :math:`val(S \cup\{j\}) - val(S)`. The term :math:`\frac{|S|!(p-|S|-1)!}{p!}` is a normalization factor. When the number of features is small, this exact estimation approach is acceptable. However, as the number of features increases, the exact solution may become problematic.
40
+
where :math:`val` is the value function that returns the prediction of each coalition. The marginal contribution of feature :math:`i` to the coalition :math:`S` is calculated as the difference between the value of the coalition with the addition of feature :math:`i` and the value of the original coalition, i.e., :math:`val(S \cup\{i\}) - val(S)`. The term :math:`\frac{|S|!(p-|S|-1)!}{p!}` is a normalization factor. When the number of features is small, this exact estimation approach is acceptable. However, as the number of features increases, the exact solution may become problematic.
41
41
42
42
It's worth noting that the value function :math:`val`` takes the feature coalition :math:`S` as input. However, in machine learning models, the prediction is not solely based on the feature coalition but on the entire feature vector. Therefore, we need to specify how removing a feature from the feature vector affects the prediction. Two common approaches are available, both of which depend on a pre-defined background distribution instead of merely replacing the "missing" features with a fixed value.
<p>where <spanclass="math notranslate nohighlight">\(g\)</span> is the explanation method, <spanclass="math notranslate nohighlight">\(p\)</span> is the number of features, and <spanclass="math notranslate nohighlight">\(z^{\prime} \in \{0, 1\}^p\)</span> is the coalition vector that indicates the on or off state of each feature. The Shapley value of the <spanclass="math notranslate nohighlight">\(j\)</span>-th feature is denoted as <spanclass="math notranslate nohighlight">\(\phi_{j}\)</span>, which can be estimated using various approaches. In PiML, the Shapley values are computed based on the <aclass="reference external" href="https://pypi.org/project/shap/">shap</a> Python package, which offers several methods for estimating Shapley values. The following sections will introduce these estimation algorithms in detail. <strong>In particular, we use the `shap.Explainer` if the estimator is supported by the shap_ Python package. Otherwise, we will use the exact solution if the number of features is less than or equal to 15, and otherwise KernelSHAP.</strong></p>
228
228
<sectionid="exact-solution">
229
229
<h3><spanclass="section-number">4.2.2.1.1. </span>Exact Solution<aclass="headerlink" href="#exact-solution" title="Permalink to this heading">¶</a></h3>
230
-
<p>The exact solution is obtained using the Shapley value formula, which requires evaluating all possible coalitions of features with and without the <spanclass="math notranslate nohighlight">\(j\)</span>-th feature.</p>
230
+
<p>The exact solution is obtained using the Shapley value formula, which requires evaluating all possible coalitions of features with and without the <spanclass="math notranslate nohighlight">\(i\)</span>-th feature.</p>
<p>where <spanclass="math notranslate nohighlight">\(val\)</span> is the value function that returns the prediction of each coalition. The marginal contribution of feature <spanclass="math notranslate nohighlight">\(j\)</span> to the coalition <spanclass="math notranslate nohighlight">\(S\)</span> is calculated as the difference between the value of the coalition with the addition of feature <spanclass="math notranslate nohighlight">\(j\)</span> and the value of the original coalition, i.e., <spanclass="math notranslate nohighlight">\(val(S \cup \{j\}) - val(S)\)</span>. The term <spanclass="math notranslate nohighlight">\(\frac{|S|!(p-|S|-1)!}{p!}\)</span> is a normalization factor. When the number of features is small, this exact estimation approach is acceptable. However, as the number of features increases, the exact solution may become problematic.</p>
235
+
<p>where <spanclass="math notranslate nohighlight">\(val\)</span> is the value function that returns the prediction of each coalition. The marginal contribution of feature <spanclass="math notranslate nohighlight">\(i\)</span> to the coalition <spanclass="math notranslate nohighlight">\(S\)</span> is calculated as the difference between the value of the coalition with the addition of feature <spanclass="math notranslate nohighlight">\(i\)</span> and the value of the original coalition, i.e., <spanclass="math notranslate nohighlight">\(val(S \cup \{i\}) - val(S)\)</span>. The term <spanclass="math notranslate nohighlight">\(\frac{|S|!(p-|S|-1)!}{p!}\)</span> is a normalization factor. When the number of features is small, this exact estimation approach is acceptable. However, as the number of features increases, the exact solution may become problematic.</p>
236
236
<p>It’s worth noting that the value function <spanclass="math notranslate nohighlight">\(val\)</span> takes the feature coalition <spanclass="math notranslate nohighlight">\(S\)</span> as input. However, in machine learning models, the prediction is not solely based on the feature coalition but on the entire feature vector. Therefore, we need to specify how removing a feature from the feature vector affects the prediction. Two common approaches are available, both of which depend on a pre-defined background distribution instead of merely replacing the “missing” features with a fixed value.</p>
237
237
<p>The former conditions the set of features in the coalition and uses the remaining features to estimate the missing features, but it can be challenging to obtain the conditional expectation in practice. The latter approach breaks the dependency among features and intervenes directly on the missing features of the sample being explained, using corresponding features from the background sample. This approach is used in the KernelSHAP algorithm.</p>
0 commit comments