Skip to content

Commit ec722cd

Browse files
author
simon.grah
committed
New MonteCarloShapleyBatch function added
1 parent d370d61 commit ec722cd

16 files changed

+940
-401
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ If the dimension exceeds about 15, then you may need approximation algorithms to
7272
mc_shap = MonteCarloShapley(x=x, fc=fc, ref=reference, n_iter=1000)
7373
```
7474

75+
If your reward function `fc` can handle data set of inputs, the batch version of Monte Carlo algorithm is more efficient as it calls `fc` only once:
76+
```python
77+
mc_shap_batch = MonteCarloShapleyBatch(x=x, fc=fc, ref=reference, n_iter=1000)
78+
```
7579

7680
* Projected Stochastic Gradient Descent algorithm:
7781

docs/_data/sidebars/home_sidebar.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ entries:
1111
url: /
1212
- output: web,pdf
1313
title: Callback
14-
url: /inspector
14+
url: inspector.html
1515
- output: web,pdf
1616
title: Monte Carlo Shapley
17-
url: /monte_carlo_shapley
17+
url: monte_carlo_shapley.html
1818
- output: web,pdf
1919
title: Plots
20-
url: /plots
20+
url: plots.html
2121
- output: web,pdf
2222
title: Projected Stochastic Gradient Shapley
23-
url: /sgd_shapley
23+
url: sgd_shapley.html
2424
- output: web,pdf
2525
title: Shapley Value
26-
url: /shapley_values
26+
url: shapley_values.html
2727
output: web
2828
title: shapkit
2929
output: web

docs/index.html

+5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
title: Shapkit
44

5+
56
keywords: fastai
67
sidebar: home_sidebar
78

89
summary: "Interpret machine learning predictions using agnostic local feature importance based on Shapley Values. Documentation: https://thalesgroup.github.io/shapkit/"
910
description: "Interpret machine learning predictions using agnostic local feature importance based on Shapley Values. Documentation: https://thalesgroup.github.io/shapkit/"
11+
nb_path: "nbs/index.ipynb"
1012
---
1113
<!--
1214
@@ -121,6 +123,9 @@ <h2 id="How-to-use">How to use<a class="anchor-link" href="#How-to-use"> </a></h
121123
</ul>
122124
<div class="highlight"><pre><span></span><span class="n">mc_shap</span> <span class="o">=</span> <span class="n">MonteCarloShapley</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">x</span><span class="p">,</span> <span class="n">fc</span><span class="o">=</span><span class="n">fc</span><span class="p">,</span> <span class="n">ref</span><span class="o">=</span><span class="n">reference</span><span class="p">,</span> <span class="n">n_iter</span><span class="o">=</span><span class="mi">1000</span><span class="p">)</span>
123125
</pre></div>
126+
<p>If your reward function <code>fc</code> can handle data set of inputs, the batch version of Monte Carlo algorithm is more efficient as it calls <code>fc</code> only once:</p>
127+
<div class="highlight"><pre><span></span><span class="n">mc_shap_batch</span> <span class="o">=</span> <span class="n">MonteCarloShapleyBatch</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">x</span><span class="p">,</span> <span class="n">fc</span><span class="o">=</span><span class="n">fc</span><span class="p">,</span> <span class="n">ref</span><span class="o">=</span><span class="n">reference</span><span class="p">,</span> <span class="n">n_iter</span><span class="o">=</span><span class="mi">1000</span><span class="p">)</span>
128+
</pre></div>
124129
<ul>
125130
<li>Projected Stochastic Gradient Descent algorithm:</li>
126131
</ul>

docs/inspector.html

+9-7
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
title: Callback
44

5+
56
keywords: fastai
67
sidebar: home_sidebar
78

89
summary: "A closure called to update metrics after each iteration."
910
description: "A closure called to update metrics after each iteration."
11+
nb_path: "nbs/inspector.ipynb"
1012
---
1113
<!--
1214
@@ -45,13 +47,6 @@
4547

4648
<div class="cell border-box-sizing code_cell rendered">
4749

48-
</div>
49-
{% endraw %}
50-
51-
{% raw %}
52-
53-
<div class="cell border-box-sizing code_cell rendered">
54-
5550
<div class="output_wrapper">
5651
<div class="output">
5752

@@ -70,6 +65,13 @@ <h4 id="inspector" class="doc_header"><code>inspector</code><a href="https://git
7065
</div>
7166
</div>
7267

68+
</div>
69+
{% endraw %}
70+
71+
{% raw %}
72+
73+
<div class="cell border-box-sizing code_cell rendered">
74+
7375
</div>
7476
{% endraw %}
7577

0 commit comments

Comments
 (0)