RelevancePropagation

Layerwise Relevance Propagation in Julia.

https://github.com/julia-xai/relevancepropagation.jl

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in README
  • Academic publication links
    Links to: nature.com, plos.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.2%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Layerwise Relevance Propagation in Julia.

Basic Info
  • Host: GitHub
  • Owner: Julia-XAI
  • License: mit
  • Language: Julia
  • Default Branch: main
  • Size: 1.65 MB
Statistics
  • Stars: 7
  • Watchers: 2
  • Forks: 2
  • Open Issues: 1
  • Releases: 7
Created over 2 years ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog License Citation

README.md

RelevancePropagation.jl

| Documentation | Build Status | |:----------------- |:---------------- | | Stable documentation Latest documentation | Build Status Coverage Status Aqua QA |

Julia implementation of Layerwise Relevance Propagation (LRP) and Concept Relevance Propagation (CRP) for use with Flux.jl models.

This package is part of the Julia-XAI ecosystem and compatible with ExplainableAI.jl.

Installation

This package supports Julia ≥1.10. To install it, open the Julia REPL and run julia-repl julia> ]add RelevancePropagation

Example

Let's use LRP to explain why an image of a castle gets classified as such using a pre-trained VGG16 model from Metalhead.jl:

```julia using RelevancePropagation using VisionHeatmaps # visualization of explanations as heatmaps using Flux, Metalhead # pre-trained vision models in Flux using DataAugmentation # input preprocessing using HTTP, FileIO, ImageIO # load image from URL using ImageInTerminal # show heatmap in terminal

Load & prepare model

model = VGG(16, pretrain=true).layers model = strip_softmax(model) model = canonize(model)

Load input

url = HTTP.URI("https://raw.githubusercontent.com/Julia-XAI/ExplainableAI.jl/gh-pages/assets/heatmaps/castle.jpg") img = load(url)

Preprocess input

mean = (0.485f0, 0.456f0, 0.406f0) std = (0.229f0, 0.224f0, 0.225f0) tfm = CenterResizeCrop((224, 224)) |> ImageToTensor() |> Normalize(mean, std) input = apply(tfm, Image(img)) # apply DataAugmentation transform input = reshape(input.data, 224, 224, 3, :) # unpack data and add batch dimension

Run XAI method

composite = EpsilonPlusFlat() analyzer = LRP(model, composite) expl = analyze(input, analyzer) # or: expl = analyzer(input) heatmap(expl) # show heatmap using VisionHeatmaps.jl ```

We can also get an explanation for the activation of the output neuron corresponding to the "street sign" class by specifying the corresponding output neuron position 920:

julia analyze(input, analyzer, 920)

Heatmaps for all implemented analyzers are shown in the following table. Red color indicate regions of positive relevance towards the selected class, whereas regions in blue are of negative relevance.

| Analyzer | Heatmap for class "castle" |Heatmap for class "street sign" | |:--------------------------------------------- |:------------------------------:|:----------------------------------:| | LRP with EpsilonPlus composite | | | | LRP with EpsilonPlusFlat composite | | | | LRP with EpsilonAlpha2Beta1 composite | | | | LRP with EpsilonAlpha2Beta1Flat composite | | | | LRP with EpsilonGammaBox composite | | | | LRP with ZeroRule (discouraged) | | |

Acknowledgements

Adrian Hill acknowledges support by the Federal Ministry of Education and Research (BMBF) for the Berlin Institute for the Foundations of Learning and Data (BIFOLD) (01IS18037A).

Owner

  • Name: Julia Explainable AI
  • Login: Julia-XAI
  • Kind: organization

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
  - family-names: "Hill"
    given-names: "Adrian"
    orcid: "https://orcid.org/0009-0009-5977-301X"
title: "RelevancePropagation.jl"
version: 1.0.0
date-released: 2024-01-30
url: "https://github.com/Julia-XAI/RelevancePropagation.jl"

GitHub Events

Total
  • Watch event: 2
  • Issue comment event: 2
Last Year
  • Watch event: 2
  • Issue comment event: 2

Committers

Last synced: 10 months ago

All Time
  • Total Commits: 38
  • Total Committers: 2
  • Avg Commits per committer: 19.0
  • Development Distribution Score (DDS): 0.053
Past Year
  • Commits: 10
  • Committers: 1
  • Avg Commits per committer: 10.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Adrian Hill a****l@m****g 36
Maximilian-Stefan-Ernst 3****t 2
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 1
  • Total pull requests: 23
  • Average time to close issues: less than a minute
  • Average time to close pull requests: 10 days
  • Total issue authors: 1
  • Total pull request authors: 2
  • Average comments per issue: 7.0
  • Average comments per pull request: 1.3
  • Merged pull requests: 21
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 7
  • Average time to close issues: N/A
  • Average time to close pull requests: about 1 hour
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.14
  • Merged pull requests: 7
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • JuliaTagBot (1)
Pull Request Authors
  • adrhill (28)
  • Maximilian-Stefan-Ernst (8)
Top Labels
Issue Labels
Pull Request Labels
run benchmark (3) BREAKING (2)

Packages

  • Total packages: 1
  • Total downloads:
    • julia 1 total
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 7
juliahub.com: RelevancePropagation

Layerwise Relevance Propagation in Julia.

  • Versions: 7
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 1 Total
Rankings
Dependent repos count: 9.9%
Average: 24.8%
Dependent packages count: 39.7%
Last synced: 7 months ago

Dependencies

.github/workflows/Benchmark.yml actions
  • actions/cache v3 composite
  • actions/checkout v4 composite
  • julia-actions/setup-julia latest composite
.github/workflows/CI.yml actions
  • actions/checkout v4 composite
  • codecov/codecov-action v3 composite
  • julia-actions/cache v1 composite
  • julia-actions/julia-buildpkg v1 composite
  • julia-actions/julia-processcoverage v1 composite
  • julia-actions/julia-runtest v1 composite
  • julia-actions/setup-julia v1 composite
.github/workflows/CompatHelper.yml actions
.github/workflows/TagBot.yml actions
  • JuliaRegistries/TagBot v1 composite