Giter Club home page Giter Club logo

rodrigobdz / lrp Goto Github PK

View Code? Open in Web Editor NEW
12.0 3.0 1.0 90.02 MB

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

Home Page: https://pypi.org/project/lrp-pf-auc/

License: MIT License

Python 88.73% Shell 11.27%
activation-curve layer-wise-relevance-propagation pixel-flipping region-perturbation pruning-curve area-under-curve qualitative-evaluation quantitative-evaluation dataloader ilsvrc2012

lrp's Introduction

Layer-Wise Relevance Propagation

DOI PyPI Version License

PyTorch implementation of Layer-wise Relevance Propagation (LRP) algorithm together with quantitative evaluation metrics to compare heatmap explanations objectively part of master's thesis In-Depth Hyperparameter Selection For Layer-Wise Relevance Propagation at TU Berlin.

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.6 (v0.1.6). Zenodo. https://doi.org/10.5281/zenodo.6821295

  • BibTeX:

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

Credits

This implementation is based on insights from:

License

MIT © rodrigobdz

lrp's People

Contributors

rodrigobdz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

simonsclz

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.