Skip to main content

Explain Neural Networks using Layer-wise Relevance Propagation and evaluate the explanations using Pixel-Flipping and Area Under the Curve.

Project description

LRP

DOI PyPI Version License

Implementation of Layer-wise Relevance Propagation (LRP) algorithm together with quantitative evaluation metrics to compare heatmap explanations objectively.

Special thanks to Dr. Grégoire Montavon for his insights, which shaped the development of this project.

Features

Explainability:

  • Layer-wise Relevance Propagation (LRP)

Quantitative Evaluation:

  • Pixel Flipping (PF), also known as Region Perturbation (RP)
    • Perturbation modes:
      • inpainting
      • random
    • Sort objectives:
      • most relevant first (MoRF), also known as activation curve
      • least relevant first (LRF), also known as pruning curve
      • random
  • AUC (Area Under the Curve), also known as AUAC (Area Under the Activation Curve) or AU-MSE (Area Under the Mean Squared Error Curve) depending on the sort objective

Showcase

LRP (lrp-tutorial composite) and PF with inpainting perturbation mode and sort objective MoRF.

Classification scores of castle image with inpainting perturbation mode

Number of simultaneous flips per perturbation step during Pixel-Flipping.


PF perturbation mode random

LRP (lrp-tutorial composite) and PF with random perturbation mode and sort objective MoRF.

Classification scores of castle image with random perturbation mode

Requirements

  • python3 >= 3.9

Installation

python3 -m pip install lrp-pf-auc

The PyPI distribution lrp-pf-auc provides the following two packages: lrp and pf.

The name lrp-pf-auc stands for Layer-wise Relevance Propagation (LRP), Pixel Flipping (PF), and Area Under the Curve (AUC) respectively.

Usage

Refer to demo.ipynb for an example of Layer-wise Relevance Propagation (LRP), Pixel-Flipping (PF) and Area under the Curve (AUC).

Feel free to check out the Jupyter notebooks under experiments/notebooks for a chronological overview of the project.

Related Projects

Citation

Cite as:

  • Plaintext:

    Rodrigo Bermúdez Schettino. (2022). rodrigobdz/lrp: v0.1.3 (v0.1.3). Zenodo. https://doi.org/10.5281/zenodo.6814441

  • BibTeX:

    @software{rodrigo_bermudez_schettino_2022_6814441,
      author       = {Rodrigo Bermúdez Schettino},
      title        = {rodrigobdz/lrp: v0.1.3},
      month        = jul,
      year         = 2022,
      publisher    = {Zenodo},
      version      = {v0.1.3},
      doi          = {10.5281/zenodo.6814441},
      url          = {https://doi.org/10.5281/zenodo.6814441}
    }
    

Credits

This implementation is based on insights from:

License

MIT © rodrigobdz

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lrp_pf_auc-0.1.3.tar.gz (37.4 kB view details)

Uploaded Source

Built Distribution

lrp_pf_auc-0.1.3-py3-none-any.whl (44.9 kB view details)

Uploaded Python 3

File details

Details for the file lrp_pf_auc-0.1.3.tar.gz.

File metadata

  • Download URL: lrp_pf_auc-0.1.3.tar.gz
  • Upload date:
  • Size: 37.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for lrp_pf_auc-0.1.3.tar.gz
Algorithm Hash digest
SHA256 cdea315b50add552b4c48abf74ea2cbfa761af55ed59932e0617576229ab6855
MD5 fbc13c7ae7b428f61b9c7a68d792595b
BLAKE2b-256 50e1e687292aaef03265ab99390922ae97cf38d5564f17328f7f438cdb6d9ad4

See more details on using hashes here.

File details

Details for the file lrp_pf_auc-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: lrp_pf_auc-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 44.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for lrp_pf_auc-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 12b5a2647b529c042838e5b06405712c45c860e9df51385892c93d5ff5f4777f
MD5 a560712b63b96d432517eb74ded16990
BLAKE2b-256 78d511cff6cfba2549cd288d3ceb4ca7437cdd6e70b3043fe894d2995edd1f9f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page