Giter VIP home page Giter VIP logo

removal-explanations's Introduction

Removal-based explanations

This repository implements a large number of removal-based explanations, a class of model explanation approaches that unifies many existing methods (e.g., SHAP, LIME, Meaningful Perturbations, L2X, permutation tests). Our paper presents a framework that allows us to implement many of these methods in a lightweight, modular codebase.

Our implementation does not take advantage of certain approximation approaches that make these methods fast in practice, so you may prefer to continue using the original implementations (e.g., SHAP, LIME, SAGE). We also haven't implemented every method, e.g., we do not support image blurring or feature selection approaches.

Usage

To begin, you need to clone the repository and install the library into your Python environment:

pip install .

Our code is designed around the framework described in the paper. Each model explanation method is specified by three choices:

  1. Feature removal: how the model is evaluated when features are held out
  2. Model behavior: a target quantity that's analyzed as features are removed (e.g., an individual prediction, or the model loss)
  3. Summary technique: how each feature's influence is summarized (e.g., using Shapley values)

The general use pattern looks like this:

from rexplain import removal, behavior, summary

# Get model and data
x, y = ...
model = ...

# 1) Feature removal
extension = removal.MarginalExtension(x[:512], model)

# 2) Model behavior
game = behavior.PredictionGame(x[0], extension)

# 3) Summary technique
attr = summary.ShapleyValue(game)
plt.bar(np.arange(len(attr)), attr)

For usage examples, see the following notebooks:

  • Census shows how to explain individual predictions
  • MNIST shows how to explain the model's loss for individual predictions
  • Breast cancer (BRCA) shows how to explain the dataset loss

Authors

References

Ian Covert, Scott Lundberg, Su-In Lee. "Explaining by Removing: A Unified Framework For Model Explanation." arXiv preprint:2011.14878

removal-explanations's People

Contributors

iancovert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.