Giter Club home page Giter Club logo

exmatchina's Introduction

ExMatchina

A Deep Neural Network explanation-by-example library for generating meaningful explanations. Used in our Explainability Study

Prerequisites

Install the required Python packages

pip3 install -r requirements.txt

Usage

  1. Import the ExMatchina class
from ExMatchina import ExMatchina
  1. Load ExMatchina with a particular TensorFlow model + example prototypes (e.g. training data)
# X_train.npy: a numpy array of prototypes
# model: the model of interest
training_data = np.load('./X_train.npy')
model = load_model('./model')

# selected_layer: the layer to use in identifying examples.
# We recommend the layer immediately following the last convolution (e.g. flatten layer)
selected_layer = "Flatten_1"

exm = ExMatchina(model=model, layer=selected_layer, examples=training_data)
  1. Fetch examples and corresponding indices for a given input
# X_train.npy: a numpy array of model inputs
test_data = np.load('./X_test.npy')
test_input = test_data[0]
(examples, indices) = exm.return_nearest_examples(test_input)

Examples

The Examples/ folder contains the tutorial in python notebooks on using Exmatchina for different types of input data

Data

Here's the Google Drive Link to the preprocessed data: Link

Download each of the folders there and place them in Examples/data/

Trained Models

Inside the trained_models/ folder, there are the pretrained models, named as [domain].hdf5 for each of the domains: image, text, ECG

BibTex

If you find this code and results useful in your research, please cite:

@article{jeyakumar2020can,
  title={How Can I Explain This to You? An Empirical Study of Deep Neural Network Explanation Methods},
  author={Jeyakumar, Jeya Vikranth and Noor, Joseph and Cheng, Yu-Hsi and Garcia, Luis and Srivastava, Mani},
  journal={Advances in Neural Information Processing Systems},
  volume={33},
  year={2020}
}

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.