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: README.md
+29-4Lines changed: 29 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,12 +19,14 @@
19
19
Shapley Interaction Quantification (`shapiq`) is a Python package for (1) approximating any-order Shapley interactions, (2) benchmarking game-theoretical algorithms for machine learning, (3) explaining feature interactions of model predictions. `shapiq` extends the well-known [shap](https://github.com/shap/shap) package for both researchers working on game theory in machine learning, as well as the end-users explaining models. SHAP-IQ extends individual Shapley values by quantifying the **synergy** effect between entities (aka **players** in the jargon of game theory) like explanatory features, data points, or weak learners in ensemble models. Synergies between players give a more comprehensive view of machine learning models.
20
20
21
21
## 🛠️ Install
22
-
`shapiq` is intended to work with **Python 3.10 and above**. Installation can be done via `uv` and `pip`:
23
-
22
+
`shapiq` is intended to work with **Python 3.10 and above**.
23
+
Installation can be done via `uv` :
24
24
```sh
25
25
uv add shapiq
26
26
```
27
27
28
+
or via `pip`:
29
+
28
30
```sh
29
31
pip install shapiq
30
32
```
@@ -37,6 +39,7 @@ If you are interested in the underlying game theoretic algorithms, then check ou
37
39
### Compute any-order feature interactions
38
40
39
41
Explain your models with Shapley interactions:
42
+
Just load your data and model, and then use a `shapiq.Explainer` to compute Shapley interactions.
40
43
41
44
```python
42
45
import shapiq
@@ -135,7 +138,7 @@ The pseudo-code above can produce the following plot (here also an image is adde
135
138
136
139
### Explain TabPFN
137
140
138
-
With ``shapiq`` you can also [``TabPFN``](https://github.com/PriorLabs/TabPFN) by making use of the _remove-and-recontextualize_ explanation paradigm implemented in ``shapiq.TabPFNExplainer``.
141
+
With ``shapiq`` you can also explain [``TabPFN``](https://github.com/PriorLabs/TabPFN) by making use of the _remove-and-recontextualize_ explanation paradigm implemented in ``shapiq.TabPFNExplainer``.
fsii_values = explainer.explain(X[0]) # explain with Faithful Shapley values
154
+
fsii_values = explainer.explain(data[0]) # explain with Faithful Shapley values
152
155
fsii_values.plot_force() # plot the force plot
153
156
```
154
157
155
158
<palign="center">
156
159
<imgwidth="800px"src="https://raw.githubusercontent.com/mmschlk/shapiq/main/docs/source/_static/images/fsii_tabpfn_force_plot_example.png"alt="Force Plot of FSII values as derived from the example tabpfn notebook">
157
160
</p>
158
161
162
+
### Use SPEX (SParse EXplainer) <imgsrc="https://raw.githubusercontent.com/mmschlk/shapiq/main/docs/source/_static/images/spex_logo.png"alt="spex_logo"align="right"height="75px"/>
163
+
For large-scale use-cases you can also check out the [👓``SPEX``](https://shapiq.readthedocs.io/en/latest/api/shapiq.approximator.sparse.html#shapiq.approximator.sparse.SPEX) approximator.
164
+
165
+
```python
166
+
# load your data and model with large number of features
0 commit comments