Paper: Beyond TreeSHAP: Efficient Computation of any-order Shapley Interactions for Tree Ensembles
The implementation was written and tested with python version 3.9.7. Install the dependencies via pip:
pip install -r requirements.txt
The main experiment functionality is implemented in experiments_main.py
including all plots.
The scripts for running the experiments on the individual datasets are named exp_<dataset>.py
.
Therein, you find the code for pre-processing, training, and explaining.
Warning: If you want to compare the results with the original TreeSHAP implementation, you need to
install the original TreeSHAP implementation from pip
and change a couple of lines of code in there.
Change line 250 in _tree.py from
X_missing = np.isnan(X, dtype=np.bool)
to
X_missing = np.isnan(X, dtype=bool)
and change line 1102 in _tree.py from
X_missing = np.isnan(X, dtype=np.bool)
to
X_missing = np.isnan(X, dtype=bool)
and change line 82 in _tabular.py from
self._last_mask = np.zeros(data.shape[1], dtype=np.bool)
to
self._last_mask = np.zeros(data.shape[1], dtype=bool)