Skip to content

Commit 3000075

Browse files
committed
update
1 parent 3b52037 commit 3000075

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

docs/_build/html/_sources/guides/explain/shap.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ where :math:`g` is the explanation method, :math:`p` is the number of features,
3030

3131
Exact Solution
3232
""""""""""""""""""""""""""""
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.
3434

3535
.. math::
3636
\begin{align}
3737
\phi_{i}= \sum_{S \subseteq \{1, \ldots, p\} \{ i \}} \frac{|S|!(p-|S|-1)!}{p!}(val(S \cup \{i\}) - val(S)). \tag{2}
3838
\end{align}
3939
40-
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.
4141

4242
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.
4343

docs/_build/html/guides/explain/shap.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,12 +227,12 @@ <h2><span class="section-number">4.2.2.1. </span>Algorithm Details<a class="head
227227
<p>where <span class="math notranslate nohighlight">\(g\)</span> is the explanation method, <span class="math notranslate nohighlight">\(p\)</span> is the number of features, and <span class="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 <span class="math notranslate nohighlight">\(j\)</span>-th feature is denoted as <span class="math notranslate nohighlight">\(\phi_{j}\)</span>, which can be estimated using various approaches. In PiML, the Shapley values are computed based on the <a class="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>
228228
<section id="exact-solution">
229229
<h3><span class="section-number">4.2.2.1.1. </span>Exact Solution<a class="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 <span class="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 <span class="math notranslate nohighlight">\(i\)</span>-th feature.</p>
231231
<div class="math notranslate nohighlight">
232232
\[\begin{align}
233233
\phi_{i}= \sum_{S \subseteq \{1, \ldots, p\} \{ i \}} \frac{|S|!(p-|S|-1)!}{p!}(val(S \cup \{i\}) - val(S)). \tag{2}
234234
\end{align}\]</div>
235-
<p>where <span class="math notranslate nohighlight">\(val\)</span> is the value function that returns the prediction of each coalition. The marginal contribution of feature <span class="math notranslate nohighlight">\(j\)</span> to the coalition <span class="math notranslate nohighlight">\(S\)</span> is calculated as the difference between the value of the coalition with the addition of feature <span class="math notranslate nohighlight">\(j\)</span> and the value of the original coalition, i.e., <span class="math notranslate nohighlight">\(val(S \cup \{j\}) - val(S)\)</span>. The term <span class="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 <span class="math notranslate nohighlight">\(val\)</span> is the value function that returns the prediction of each coalition. The marginal contribution of feature <span class="math notranslate nohighlight">\(i\)</span> to the coalition <span class="math notranslate nohighlight">\(S\)</span> is calculated as the difference between the value of the coalition with the addition of feature <span class="math notranslate nohighlight">\(i\)</span> and the value of the original coalition, i.e., <span class="math notranslate nohighlight">\(val(S \cup \{i\}) - val(S)\)</span>. The term <span class="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>
236236
<p>It’s worth noting that the value function <span class="math notranslate nohighlight">\(val\)</span> takes the feature coalition <span class="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>
237237
<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>
238238
<ul class="simple">

0 commit comments

Comments
 (0)