Skip to main content

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

Installation

python3 -m pip install gam

Get Started

First generate local attributions using your favorite technique, then:

>>> from gam.gam import GAM
>>> # for a quick example use `attributions_path="tests/test_attributes.csv"`
>>> # Input/Output: csv (columns: features, rows: local/global attribution)
>>> gam = GAM(attributions_path="<path_to_your_attributes>.csv", distance="spearman", k=2)
>>> 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

Tests

To run tests:

$ python -m pytest tests/

Contributors

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.

Metadata

Release files for gam 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gam 1.3.0
File Size Uploaded
gam-1.3.0.tar.gz 23.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gam 1.3.0
File Interpreter ABI Platform
gam-1.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 49.3 kB

Release files / gam-1.3.0.tar.gz

Download URL gam-1.3.0.tar.gz
Size 23.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ec2a4d1ae0db30db4e8fe00549a5a9e7c7db401b931ae1e0782c82a037e6ddfa
BLAKE2b-256 checksum
How to use checksums
af86ad62c5010478a94a0ff4429004efbccf1874bab9cadea00f8d994c308a4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.7.10

Release files / gam-1.3.0-py3-none-any.whl

Download URL gam-1.3.0-py3-none-any.whl
Size 26.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cc6066d2202de70891ba1bb17f31feff35de4312d0047af584a33f04ae63096a
BLAKE2b-256 checksum
How to use checksums
ebdc438a86ff274517a3dadcfa39e29a98efc3f91a95dd2f9bf502fcb4685116
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.7.10

Release history Release notifications | RSS feed

This release

1.3.0 This release

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page