Skip to content

Commit 0d22d7d

Browse files
authored
Refactoring TreeExplainer, Adding InterventionalTreeExplainer and RegressionMSR approximator. (#519)
* update datast * remove local tabarena datasets * Update the TreeExplainer. Introducing improved InterventionalTreeExplainer. Improved Tree conversions. Added CatBoostSupport. * Added proper XGBoost support for LinearTreeSHAP. * add Windows support for SIMD * update docs examples * Added citation to RegressionMSR
1 parent 4300f40 commit 0d22d7d

52 files changed

Lines changed: 9331 additions & 3494 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ cython_debug/
177177

178178
illustration_sources/
179179

180-
# remove the files that will be downloaded
181-
shapiq/datasets/data
180+
# cached TabArena datasets — regenerated on demand by the loaders from OpenML
181+
src/shapiq_games/datasets/data/tabarena_*.csv
182182

183183
shapiq/games/benchmark/precomputed/
184184
precomputed.zip

AGENTS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ This role of this file is to describe common mistakes and confusion points that
44

55
## Commands to interact with the codebase which you should run:
66

7+
## Conversion package note
8+
9+
Boosting converters live in separate modules such as `xgboost.py`,
10+
`lightgbm.py`, and `catboost.py`, and are hooked up through lazy registrations in
11+
`src/shapiq/tree/conversion/__init__.py`.
12+
713
### Build Docs (only use this command verbatim from the project root)
814

915
```bash

CHANGELOG.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## v1.5.0 (unreleased)
44

5+
### Extending shapiq-games [#476](https://github.com/mmschlk/shapiq/issues/476)
6+
- adds standard SHAP datasets for benchmarking in `shapiq_games.benchmark.local_xai`.
7+
- adds **all** TabArena datasets for benchmarking in `shapiq_games.benchmark.local_xai`.
8+
59
### Python Version [#497](https://github.com/mmschlk/shapiq/pull/497)
610

711
- adds support for Python 3.14 making the package compatible with the latest Python version.
@@ -15,7 +19,7 @@
1519
### List of All New Features
1620

1721
- adds `ProxySHAP` approximator in `shapiq.approximator.proxy` for proxy-model-accelerated interaction estimation
18-
- adds `MSRBiased` approximator for biased multilinear-extension sampling regression
22+
- adds `RegressionMSR` approximator in `shapiq.approximator.proxy` for proxy-model accelerated value estimation
1923
- adds `LinearTreeSHAP` in `shapiq.tree.linear` for fast first-order Shapley value computation
2024
- refactors `shapiq.tree` into submodules: `conversion/`, `linear/`, `interventional/`
2125
- adds `InterventionalTreeExplainer` and `InterventionalGame` in `shapiq.tree.interventional`
@@ -25,14 +29,13 @@
2529
#### Introducing ProxySHAP [#501](https://github.com/mmschlk/shapiq/pull/501)
2630

2731
Adds [`ProxySHAP`](src/shapiq/approximator/proxy/proxyshap.py) as a new approximator that accelerates Shapley interaction estimation by fitting a lightweight **proxy tree model** (XGBoost by default) on sampled coalitions, computing _exact_ interactions for the proxy via the `InterventionalTreeExplainer`, and then optionally correcting for the approximation error on the true model.
32+
Adds [`RegressionMSR`](srd/shapiq/approximator/proxy/regressionmsr.py) as a new approximator that accelerates Shapley value estimation by fitting a lightweight **proxy tree model** (XGBoost by default) on sampled coalitions, computing _exact_ interactions for the proxy via the `InterventionalTreeExplainer`, and then optionally correcting for the approximation error on the true model.
2833

2934
Four adjustment strategies are supported:
3035

3136
- **`"none"`**: use proxy interactions directly (fastest, least accurate)
32-
- **`"msr-b"`** _(default)_: biased MSR adjustment using the new `MSRBiased` approximator
33-
- **`"shapiq"`** / **`"svarm"`** / **`"kernel"`**: unbiased adjustments via established estimators
37+
- **`"msr"`** / **`"svarm"`** / **`"kernel"`**: unbiased adjustments via established estimators
3438

35-
The internal `MSRBiased` approximator is also exposed for use as a standalone estimator.
3639
This implementation relies on C-extension routines (`compute_interactions_sparse`) for high-throughput coalition evaluation.
3740

3841
#### Introducing LinearTreeSHAP [#501](https://github.com/mmschlk/shapiq/pull/501)
@@ -57,11 +60,18 @@ shapiq/tree/
5760
└── interventional/ — InterventionalTreeExplainer and InterventionalGame
5861
```
5962

63+
The conversion of the tree methods has been moved to C++ giving at least 2x up to 6x times speeup over shap tree conversion.
64+
6065
#### Introducing Explainers for Nearest Neighbor Models
6166

6267
Adds three new explainers, namely `KNNExplainer`, `WeightedKNNExplainer` and `ThresholdNNExplainer`, which efficiently compute explanations for nearest neighbor models from the [scikit-learn](https://scikit-learn.org/stable/) library.
6368
One application of these explainers is Data Valuation, i.e. the task of evaluating the usefulness of training data points for training models.
6469

70+
### Bugfix
71+
72+
- fixes a bug in tree conversion, such that tree models with no splits are still correctly parsed. [#370](https://github.com/mmschlk/shapiq/issues/370)
73+
- fixes `min_order` in `TreeExplainer` so that it now actually restricts the returned `InteractionValues` to interactions of order ``min_order..max_order`` (``min_order=0`` continues to include the empty interaction at the baseline value); invalid values now raise a clear `ValueError`. [#325](https://github.com/mmschlk/shapiq/issues/325)
74+
6575
## v1.4.1 (2025-11-10)
6676

6777
### Bugfix

0 commit comments

Comments
 (0)