This directory contains implementations of FastSHAP for both tensorflow and pytorch users, which can be found in the following sub-directories:
fastshap_tf
fastshap_torch
Run the following in shell to install the required packages:
git clone https://github.com/neurips3408/fastshap
cd fastshap
sudo pip install -r requirements.txt
cd ..
git clone https://github.com/iancovert/shapley-regression
cd shapley-regression
pip install .
cd ..
git clone https://github.com/iancovert/sage
cd sage
pip install .
All the notebooks used to generate the structured data results can be found in experiments-torch
.
Each sub-directory corresponds to an experiment and is labeled according to the structured dataset and/or value function for which results were generated.
Each experiment generally contains the following files:
train_models.ipynb
: Trains the model we explain and the surrogate model used for the value function.fastshap.ipynb
: Trains the fastSHAP explainer model.kernelshap.ipynb
: Generates Shapley values using both KernelSHAP (w/o paired sampling) and Permutation Sampling (w/o antithetical sampling).evalutation.ipynb
: Compares each shapley value estimation method and generates the results reported in the paper.
All the notebooks used to generate the imaging data results can be found in experiments/images
.
Each sub-directory corresponds to imaging dataset used for our experiments.
Each dataset directory contains the following files used to generate the explanations:
save_images.ipynb
: Saves 100 random images from the test set for explanation.model_train.ipynb
: Trains the model we explainsurrogate_train.ipynb
: Trains the surrogate model used for the value function.fastshap.ipynb
: Trains the fastSHAP explainer model.ks_explain.py
: Generates Shapley values using KernelSHAP w/ the baseline value function.ks_plus_explain.py
: Generates Shapley values using KernelSHAP w/ the surrogate value function.job_ks_explain.sh
: Schedules a job to explain images in parallel viaks_explain.py
.job_ks_plus_explain.sh
: Schedules a job to explain images in parallel viaks_plus_explain.py
.compile_results.ipynb
: Compiles KernelSHAP shapley values and runtimes from their save folders.gradient_explain.ipynb
: Computes gradeint explanations for each of the gradient-based methods.
The following files were used to evaluate each explanation method and generate the figures and results reported in the paper. These files can be found in the evaluation
sub-directory.
make_selections.ipynb
: Selects the top n% of features to include or exclude based on their estimated importances.train_evaluator.ipynb
: Trains the evaluator model.evaluate.ipynb
: Generates the Exlcusion and Inclusion Curves and computes the cooresponding AUCs.plot_explanations.ipynb
: Plots explanations generated by each method for a random set of images.plot_images.ipynb
: Plots explanations about each class generated by FastSHAP for a random set of images.