Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
marksibrahim Merge pull request #1 from capitalone/plotting-fix
fixed plotting getting cut off
Latest commit e08754d Mar 13, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
tests adding v0 library Jan 26, 2019
LICENSE Initial commit Jan 25, 2019
requirements.txt adding v0 library Jan 26, 2019

GAM (Global Attribution Mapping)

Global Explanations for Deep Neural Networks

GAM explains the landscape of neural network predictions across subpopulations.

This implementation is based on "Global Explanations for Neural Networks: Mapping the Landscape of Predictions" (AAAI/ACM AIES 2019).

Get Started

First generate local attributions using your favorite technique, then

>>> gam = GAM(local_path="local_attributions.csv", 
>>> gam.generate()
>>> gam.explanations
[[('height', .6), ('weight', .3), ('hair color', .1)], 
 [('weight', .9), ('weight', .05), ('hair color', .05)]]
>>> gam.subpopulation_sizes
[90, 10]

>>> gam.subpopulations
# global explanation assignment
[0, 1, 0, 0,...]

>>> gam.plot()
# bar chart of feature importance with subpopulation size


Thank you to Paul Zeng for his contribution to the implementation and valuable feedback.


  • Python 3.6, Pytest, requirements.txt for dependencies
  • Branching: master is protected (need one other reviewer to merge)
  • Input/Output: csv (columns: features, rows: local/global attribution)
  • Underlying data structures: numpy arrays


To run tests:

$ python -m pytest tests/


  • assume local attributions are given
  • K is a specified parameter
  • accompany csv output with a simple visualization showing top 5 clusters and their top 5 features


  • optimize k based on silouhette score
  • generate local attributions (using appropriate local method)


We welcome Your interest in Capital One’s Open Source Projects (the “Project”). Any Contributor to the Project must accept and sign an Agreement indicating agreement to the license terms below. Except for the license granted in this Agreement to Capital One and to recipients of software distributed by Capital One, You reserve all right, title, and interest in and to Your Contributions; this Agreement does not impact Your rights to use Your own Contributions for any other purpose.

Sign the Individual Agreement

Sign the Corporate Agreement

Code of Conduct

This project adheres to the Open Code of Conduct By participating, you are expected to honor this code.

You can’t perform that action at this time.