Skip to content

Conversation

@jhnwu3
Copy link
Collaborator

@jhnwu3 jhnwu3 commented Feb 1, 2026

This pull request introduces a new example script for benchmarking StageNet with Integrated Gradients on MIMIC-IV, and significantly improves the efficiency and flexibility of the Integrated Gradients interpretability method. The main changes include memory optimizations, configurable step size, and improved handling of processor loading and dataset configuration in the example scripts.

Integrated Gradients Method Improvements:

  • The IntegratedGradients class now accepts a steps parameter in its constructor, allowing users to set a default number of interpolation steps for the path integral approximation, which can be overridden per-call in attribute(). This makes the method more flexible and user-friendly. [1] [2] [3] [4] [5]
  • The core IG computation now uses a memory-efficient running sum to accumulate gradients instead of storing all gradients for each interpolation step, greatly reducing memory usage for large models and batch sizes. [1] [2] [3]
  • The _compute_final_attributions method is updated to work with averaged gradients instead of lists, reflecting the new memory-efficient approach. [1] [2]

New Example Script:

  • Added examples/interpretability/integrated_gradients_benchmark_stagenet.py, a comprehensive example demonstrating how to load MIMIC-IV data, use cached processors, apply the StageNet mortality prediction task, benchmark model performance, and compute Integrated Gradients attributions and faithfulness metrics.

Dataset and Processor Handling Improvements:

  • Increased the number of worker processes (num_workers) for dataset loading and task application in integrated_gradients_mortality_mimic4_stagenet.py, which can improve data pipeline performance. [1] [2]

These changes improve both the usability and performance of interpretability workflows in the codebase, especially for large datasets and models.…and at least I was able to test it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants