Giter VIP home page Giter VIP logo

fastshapevaluation's Introduction

Codebase for "FastSHAP: Real-Time Shapley Value Estimation"

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

Dependencies

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 .

Experiments

Structured Data

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.

Imaging Data

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 explain
  • surrogate_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 via ks_explain.py.
  • job_ks_plus_explain.sh: Schedules a job to explain images in parallel via ks_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.

FastSHAPEvaluation

fastshapevaluation's People

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.