Quantitative Attributions with Counterfactuals

Diane-Yayra Adjavon, Nils Eckstein, Alexander Shakeel Bates, Gregory S.x.e. Jefferis, Jan FunkebioRxiv 2024 · DOI

TL;DR

This paper introduces QuAC (Quantitative Attributions with Counterfactuals), a novel method for explaining deep neural network decisions on images. QuAC generates counterfactual images to highlight subtle, class-discriminating visual features, and crucially, provides a quantitative score to evaluate the quality of these explanations. This approach offers a powerful tool for understanding complex biological image classification tasks and discovering new biological insights.

What Problem Does This Paper Address?

Explaining the decisions of deep neural networks (DNNs) is crucial, especially in fields like biomedical imaging where subtle visual differences can be hard for humans to discern. Existing "explainability" methods often highlight important regions but lack a quantitative way to assess the quality or reliability of these explanations. This makes it difficult to trust the explanations or compare different methods. The authors aim to bridge this gap by developing a method that not only identifies class-discriminating features but also quantifies how well these features explain the classifier's decision, enabling more robust biological discovery.

Methods

The core of QuAC involves two main components:

  1. Counterfactual Image Generation: A separate generative network (specifically, a StarGANv2 variant) is trained to translate an input image from its original class to a target class. The goal is to create a generated image that is as similar as possible to the original, differing only in the minimal set of features necessary to change the classifier's predicted class. This ensures that the generated image is still "in-distribution" for the target class.
  2. Discriminative Attribution and Scoring: Once a counterfactual image is generated, a discriminative attribution method is used to identify which pixels or regions contribute most to the change in the classifier's decision between the original and counterfactual images. By creating binary masks of increasing size based on these attributions, the authors can generate "hybrid" images. They then quantify how much changing the classifier's output changes as these masks grow. This relationship is captured by a "QuAC curve," and the area under this curve serves as a quantitative score for the attribution method's quality and the importance of the identified features. The smallest mask that achieves the largest change in classifier output defines the optimal counterfactual and its explanation.

Datasets

The authors evaluated QuAC on two datasets:

  1. Synthetic Cells Dataset: A custom dataset created to mimic microscopy images with known class differences. This dataset features four classes based on variations in cell membrane elongation and punctae aggregation, allowing for a controlled test of QuAC's ability to recover known biological features.
  2. Drosophila melanogaster Synapses Dataset: An electron microscopy dataset of synapses, each labeled with one of six neurotransmitters. This dataset presents a challenging classification task where visual differences are subtle and not easily discernible by human experts.

Key Insights and Ideas

  • Quantifying Explanation Quality: The most significant contribution is the introduction of a quantitative score (the QuAC score) to evaluate the fidelity and informativeness of visual explanations. This moves beyond simply highlighting regions to providing a measure of "how good" an explanation is.
  • Discovering Unknown Biological Differences: QuAC successfully identified previously unknown visual differences between synapse types, demonstrating its potential for novel biological discovery in complex datasets.
  • Interrogating Misclassifications: The method can be used to understand why a classifier makes mistakes, shedding light on unexpected similarities between classes or subtle features that lead to errors.
  • Bridging Human and Machine Perception: By generating counterfactuals that highlight features important to the classifier, QuAC can help bridge the gap between how machines and humans perceive visual differences.
  • Robustness to Classifier Quality: While QuAC's explanations are most informative when the classifier is accurate, it can still provide insights into the decision boundary of even mediocre classifiers.

Key Results

  • Synthetic Data: QuAC was able to perfectly recover the known class-defining features (cell elongation and punctae aggregation) from the synthetic dataset.
  • Synapse Data: QuAC revealed previously unknown visual differences between synapse types, providing new hypotheses about their structure-function relationships. For example, it identified subtle differences in post-synaptic densities, cleft width, and vesicle presence that distinguish synapse classes.
  • Diabetic Retinopathy: In a case study on retinal images, QuAC's masks covered most of the known lesions but also highlighted larger image fractions than human experts, suggesting the classifier uses more information than just the obvious lesions.
  • Attribution Method Ranking: The QuAC score allowed the authors to rank different attribution methods, identifying Integrated Gradients as performing particularly well.

Limitations and Future Work

  • Human Annotation Dependency: The final step of interpreting the counterfactuals still requires human annotation, and there's no guarantee that the discovered differences will be human-interpretable or visually obvious.
  • Generator Quality: The effectiveness of QuAC relies heavily on the quality of the counterfactual image generation. A poor generator can limit the number and informativeness of explanations.
  • Localized Features: QuAC works best on images where class-relevant differences are localized. Global features (like overall intensity variations) might lead to less interpretable attribution maps.
  • Future Work: The authors suggest exploring alternative generative models (e.g., diffusion models), investigating multiple counterfactual explanations, exploring feature separation in the style space, and incorporating additional metadata into the generator. They also envision extending QuAC to non-image data like RNAseq or calcium recordings.

Summary updated

Abstract

Abstract We address the problem of explaining the decision process of deep neural network classifiers on images, which is of particular importance in biomedical datasets where class-relevant differences are not always obvious to a human observer. Our proposed solution, termed quantitative attribution with counterfactuals (QuAC), generates visual explanations that highlight class-relevant differences by attributing the classifier decision to changes of visual features in small parts of an image. To that end, we train a separate network to generate counterfactual images ( i . e ., to translate images between different classes). We then find the most important differences using novel discriminative attribution methods. Crucially, QuAC allows scoring of the attribution and thus provides a measure to quantify and compare the fidelity of a visual explanation. We demonstrate the suitability and limitations of QuAC on two datasets: (1) a synthetic dataset with known class differences, representing different levels of protein aggregation in cells and (2) an electron microscopy dataset of D. melanogaster synapses with different neurotransmitters, where QuAC reveals so far unknown visual differences. We further discuss how QuAC can be used to interrogate mispredictions to shed light on unexpected inter-class similarities and intra-class differences.
BibTeX
@misc{adjavon2024quantitative,
  author = {Diane-Yayra Adjavon and Nils Eckstein and Alexander Shakeel Bates and Gregory S.X.E. Jefferis and Jan Funke},
  title = {{Quantitative Attributions with Counterfactuals}},
  year = {2024},
  doi = {10.1101/2024.11.26.625505},
  howpublished = {bioRxiv},
}
Figure