SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1903.07317 · 2019

Layer-Wise Relevance Propagation for Explaining Deep Neural Network Decisions in MRI-Based Alzheimer's Disease Classification

arXiv · PDF · Open in the Atlas

Code that ran

7 of 10 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 7 have no contract verdict; 0 failures of our instrument; 3 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/1903.07317.json · badge: /api/ran/1903.07317.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
moboehle/Pytorch-LRP community (classifier label)
classifier basis not recorded on the link
7 ran · 3 no recorded run
FunctionStatusWhere it lives
get_image_filepath Ran
ran on a synthesized input
moboehle/Pytorch-LRP/jrieke/datasets.py
code served (permissive licence) · get_code("d653d021808bccb4")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import pandas as pd

# Create a minimal DataFrame row with the required columns
df_row = pd.Series({
    'PTID': 'PATIENT001',
    'Visit': 'Baseline Visit',
    'Scan.Date': '01/15/2023',
    'Image.ID': 'IMG123',
    'DX': 'CN'
})

ARGS = {
    'df_row': df_row,
    'root_dir': '/data/images'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
guided_backprop Ran
ran on a synthesized input
moboehle/Pytorch-LRP/jrieke/interpretation.py
code served (permissive licence) · get_code("d99b13247d460e09")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 3, dtype family float, shape (3, 2, 2) as a later run recorded it. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import numpy as np

torch.manual_seed(0)

# Build a minimal model with ReLU layers that can be hooked
class SimpleModel(nn.Module):
    def __init__(self):
        super(SimpleModel, self).__init__()
        self.fc1 = nn.Linear(12, 8)
        self.relu1 = nn.ReLU()
        self.fc2 = nn.Linear(8, 5)
        self.relu2 = nn.ReLU()
        self.fc3 = nn.Linear(5, 3)
    
    def forward(self, x):
        x = x.view(x.size(0), -1)
        x = self.fc1(x)
        x = self.relu1(x)
        x = self.fc2(x)
        x = self.relu2(x)
        x = self.fc3(x)
        return x

model = SimpleModel()
model.eval()

# Create a small image tensor (batch=2, channels=3, height=2, width=2)
image_tensor = torch.randn(2, 3, 2, 2, requires_grad=True)

# Define ARGS for guided_backprop function
ARGS = {
    'model': model,
    'image_tensor': image_tensor,
    'target_class': None,
    'postprocess': 'abs',
    'apply_softmax': True,
    'cuda': False,
    'verbose': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 3, dtype family float, shape (3, 2, 2) — shape (3, 2, 2) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
load_data_table Ran
ran on a synthesized input
moboehle/Pytorch-LRP/jrieke/datasets.py
code served (permissive licence) · get_code("6a347c65382d832f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned DataFrame. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import pandas as pd
import os
import tempfile

# Create a temporary directory for testing
temp_dir = tempfile.mkdtemp()

# Create a minimal CSV table with required columns
table_data = {
    'PTID': ['PT001', 'PT002', 'PT003'],
    'Visit': ['Baseline', 'Month 12', 'Baseline'],
    'Scan.Date': ['01/15/2020', '02/20/2021', '03/10/2020'],
    'Image.ID': ['IMG001', 'IMG002', 'IMG003'],
    'DX': ['CN', 'AD', 'CN']
}
df_table = pd.DataFrame(table_data)
table_filepath = os.path.join(temp_dir, 'data_table.csv')
df_table.to_csv(table_filepath, index=False)

# Create fake image files that the function will check for existence
image_dir = os.path.join(temp_dir, 'images')
os.makedirs(image_dir, exist_ok=True)

for idx, row in df_table.iterrows():
    filedir = os.path.join(image_dir, row['PTID'], row['Visit'].replace(' ', ''))
    os.makedirs(filedir, exist_ok=True)
    filename = '{}_{}_{}_{}_{}_Warped.nii.gz'.format(
        row['PTID'],
        row['Scan.Date'].replace('/', '-'),
        row['Visit'].replace(' ', ''),
        row['Image.ID'],
        row['DX']
    )
    filepath = os.path.join(filedir, filename)
    # Create empty file
    open(filepath, 'a').close()

ARGS = {
    'table': table_filepath,
    'image_dir': image_dir,
    'corrupt_images': None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
load_history Ran
ran on a synthesized input
moboehle/Pytorch-LRP/jrieke/utils.py
code served (permissive licence) · get_code("4a93f04052da6ce9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import json
import tempfile
import os

# Create a temporary file with sample history data
temp_dir = tempfile.mkdtemp()
history_file = os.path.join(temp_dir, "history.json")

# Create sample history data that would come from a torchsample trainer
sample_history = {
    "train_loss": [0.5, 0.4, 0.3],
    "val_loss": [0.6, 0.5, 0.4],
    "train_acc": [0.7, 0.8, 0.85],
    "val_acc": [0.65, 0.75, 0.8]
}

# Write the history to the temporary file
with open(history_file, 'w') as f:
    json.dump(sample_history, f)

# Define arguments for the function
ARGS = {
    "filename": history_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
module_tracker Ran
ran on a synthesized input
moboehle/Pytorch-LRP/inverter_util.py
code served (permissive licence) · get_code("49f6fa7486b8f389")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned function. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Create a mock forward hook function
def mock_fwd_hook(relevance_propagator_instance, layer, *args):
    """Mock forward hook that the wrapper will call."""
    return None

# Create a mock relevance propagator instance with required attributes
class MockRelevancePropagator:
    def __init__(self):
        self.module_list = []

# Create a mock layer (simple nn.Module)
class MockLayer(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Build test data
relevance_propagator = MockRelevancePropagator()
test_layer = MockLayer()
test_input = torch.randn(2, 4)

ARGS = {
    "fwd_hook_func": mock_fwd_hook
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
occlusion Ran
ran on a synthesized input
moboehle/Pytorch-LRP/jrieke/interpretation.py
code served (permissive licence) · get_code("2b43b5562d2d92e9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 2, dtype family float, shape (3, 5) as a later run recorded it. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np

torch.manual_seed(0)

# Create a minimal model that satisfies the function's usage
class SimpleModel(nn.Module):
    def __init__(self):
        super(SimpleModel, self).__init__()
        self.fc = nn.Linear(4 * 3 * 5, 10)  # Flatten input and output 10 classes
    
    def forward(self, x):
        # x shape: (batch_size, channels, height, width) for 2D
        batch_size = x.shape[0]
        x_flat = x.view(batch_size, -1)
        return self.fc(x_flat)

# Create model in eval mode
model = SimpleModel()
model.eval()

# Create a small 2D image tensor (channels_first: C x H x W)
image_tensor = torch.randn(4, 3, 5)

ARGS = {
    'model': model,
    'image_tensor': image_tensor,
    'target_class': None,
    'size': 2,
    'stride': 1,
    'occlusion_value': 0,
    'apply_softmax': True,
    'three_d': False,
    'resize': False,
    'cuda': False,
    'verbose': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (3, 5) — shape (3, 5) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
sensitivity_analysis Ran
ran on a synthesized input
moboehle/Pytorch-LRP/jrieke/interpretation.py
code served (permissive licence) · get_code("9b0c1f25fe7ac14c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 3, dtype family float, shape (3, 4, 1) as a later run recorded it. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import numpy as np

torch.manual_seed(0)

# Create a minimal model that satisfies the function's usage
class SimpleClassifier(nn.Module):
    def __init__(self):
        super(SimpleClassifier, self).__init__()
        self.fc = nn.Linear(12, 5)  # 3 channels * 4x1 flattened = 12 inputs, 5 output classes
    
    def forward(self, x):
        x = x.view(x.size(0), -1)
        return self.fc(x)

# Create model and set to eval mode
model = SimpleClassifier()
model.eval()

# Create a small image tensor: batch_size=1, channels=3, height=4, width=1
# Using distinct dimensions: 3 channels, 4x1 spatial
image_tensor = torch.randn(1, 3, 4, 1)

# Define all arguments
ARGS = {
    'model': model,
    'image_tensor': image_tensor,
    'target_class': None,
    'postprocess': 'abs',
    'apply_softmax': True,
    'cuda': False,
    'verbose': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 3, dtype family float, shape (3, 4, 1) — shape (3, 4, 1) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
print_df_stats Not yet run
unverified (harvested, no recorded run)
moboehle/Pytorch-LRP/jrieke/datasets.py
code served (permissive licence) · get_code("ef75397d1e57b291")
How it ran

no invocation recorded.

scale_mask Not yet run
unverified (harvested, no recorded run)
moboehle/Pytorch-LRP/utils.py
code served (permissive licence) · get_code("b7dee0cd91d45f10")
How it ran

no invocation recorded.

visualize_feature_maps Not yet run
unverified (harvested, no recorded run)
moboehle/Pytorch-LRP/nitorch/callbacks.py
code served (permissive licence) · get_code("d047fc0a03c7bc51")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 10 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Deep neural networks have led to state-of-the-art results in many medical imaging tasks including Alzheimer's disease (AD) detection based on structural magnetic resonance imaging (MRI) data. However, the network decisions are often perceived as being highly non-transparent, making it difficult to apply these algorithms in clinical routine. In this study, we propose using layer-wise relevance propagation (LRP) to visualize convolutional neural network decisions for AD based on MRI data. Similarly to other visualization methods, LRP produces a heatmap in the input space indicating the importance/relevance of each voxel contributing to the final classification outcome. In contrast to susceptibility maps produced by guided backpropagation ("Which change in voxels would change the outcome most?"), the LRP method is able to directly highlight positive contributions to the network classification in the input space. In particular, we show that (1) the LRP method is very specific for individuals ("Why does this person have AD?") with high inter-patient variability, (2) there is very little relevance for AD in healthy controls and (3) areas that exhibit a lot of relevance correlate well with what is known from literature. To quantify the latter, we compute size-corrected metrics of the summed relevance per brain area, e.g., relevance density or relevance gain. Although these metrics produce very individual "fingerprints" of relevance patterns for AD patients, a lot of importance is put on areas in the temporal lobe including the hippocampus. After discussing several limitations such as sensitivity toward the underlying model and computation parameters, we conclude that LRP might have a high potential to assist clinicians in explaining neural network decisions for diagnosing AD (and potentially other diseases) based on structural MRI data.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("1903.07317")
get_code_for_paper("1903.07317")
have("1903.07317")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/1903.07317.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/1903.07317.svg)](https://syntology.ai/paper/1903.07317)

Connect an agent — have() is free.