Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
858c4f7
Adding a basic gradient saliency method that functions on the pyhealt…
Nimanui May 8, 2025
3bd6860
Updating function name for consistency and adding to the _init_.py
Nimanui May 8, 2025
ce1e510
Created using Colab
Nimanui May 8, 2025
8eb57eb
Example of using gradient saliency
Nimanui May 8, 2025
b376b8a
Delete Colab ChestXrayClassificationWithSaliency.ipynb
Nimanui May 8, 2025
0e14d97
Merge branch 'sunlabuiuc:master' into master
Nimanui May 8, 2025
57e2c3c
Adding a basic gradient saliency method that functions on the pyhealt…
Nimanui May 8, 2025
997db4a
Updating function name for consistency and adding to the _init_.py
Nimanui May 8, 2025
1c13529
Merge branch 'sunlabuiuc:master' into master
Nimanui Aug 24, 2025
5c88fbc
Merge branch 'master' into SaliencyMappingGradient
Nimanui Sep 13, 2025
9efd00e
Merge branch 'sunlabuiuc:master' into master
Nimanui Sep 21, 2025
6aeeb69
Merge branch 'master' into SaliencyMappingGradient
Nimanui Sep 21, 2025
f3f905e
Moving the saliency module to the "interpret\methods" folder
Nimanui Sep 21, 2025
15d62db
Created using Colab
Nimanui Sep 28, 2025
f98ecf8
Small bug fix and adjusting the ipynb example
Nimanui Sep 28, 2025
83d9412
Add files via upload
Nimanui Sep 28, 2025
470f54a
Created using Colab
Nimanui Sep 29, 2025
1f1628c
Locally run notebook example to remove collab dependency
Nimanui Oct 5, 2025
28c48fc
Add files via upload
Nimanui Oct 5, 2025
f6487f9
Add files via upload
Nimanui Oct 5, 2025
3a97db7
Add files via upload
Nimanui Oct 16, 2025
64a940a
Delete examples/ChestXrayClassificationWithSaliencyMapping.ipynb
Nimanui Oct 16, 2025
0b45143
Merge branch 'sunlabuiuc:master' into SaliencyMappingGradient
Nimanui Oct 16, 2025
3dbaa83
Delete ChestXrayClassificationWithSaliencyMapping.ipynb
Nimanui Oct 16, 2025
d3c320d
Update repository references in notebook
Nimanui Oct 16, 2025
e9d9d9e
Adding saliency class and adjusting code to use the class
Nimanui Oct 26, 2025
5e5fcd6
Merge pyhealth main
Nimanui Nov 1, 2025
1c1e912
Adding saliency class and adjusting code to use the class
Nimanui Oct 26, 2025
862b1c4
Refactoring methods in saliency.py
Nimanui Oct 26, 2025
1a5b8c9
Some refactoring and adding better batch handling
Nimanui Nov 2, 2025
47b2c39
Adding some documentation
Nimanui Nov 2, 2025
2d8e6d0
Merge remote-tracking branch 'upstream/master' into SaliencyMappingClass
Nimanui Nov 11, 2025
e159318
Basic Gradient imagery: removing dataload options
Nimanui Nov 11, 2025
8041c09
Merge remote-tracking branch 'upstream/master' into SaliencyMappingClass
Nimanui Nov 15, 2025
1240716
Adding base_interpreter inheritance and testing
Nimanui Nov 15, 2025
755289b
Removing redundant code and the lazy initialization
Nimanui Nov 17, 2025
e051d30
Making the input_batch optional and adding support to update it with …
Nimanui Nov 17, 2025
e2b65e2
Adding a few unit tests
Nimanui Nov 17, 2025
b9accc0
Adding some documentation
Nimanui Nov 17, 2025
26ebc71
Documentation updates
Nimanui Nov 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion docs/api/interpret.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ New to interpretability in PyHealth? Check out these complete examples:

**Browse all examples online**: https://github.com/sunlabuiuc/PyHealth/tree/master/examples

**Basic Gradient Example:**

- ``examples/ChestXrayClassificationWithSaliency.ipynb`` - Interactive notebook demonstrating gradient-based saliency mapping for medical image classification. Shows how to:

- Load and classify chest X-ray images using PyHealth's TorchvisionModel
- Generate gradient saliency maps to visualize model attention
- Interpret which regions of X-ray images influence COVID-19 predictions by the model

**DeepLift Example:**

- ``examples/deeplift_stagenet_mimic4.py`` - Demonstrates DeepLift attributions on StageNet for mortality prediction with MIMIC-IV data. Shows how to:
Expand Down Expand Up @@ -39,8 +47,9 @@ Available Methods
-----------------

.. toctree::
:maxdepth: 3
:maxdepth: 4

interpret/pyhealth.interpret.methods.basic_gradient
interpret/pyhealth.interpret.methods.chefer
interpret/pyhealth.interpret.methods.deeplift
interpret/pyhealth.interpret.methods.integrated_gradients
21 changes: 21 additions & 0 deletions docs/api/interpret/pyhealth.interpret.methods.basic_gradient.rst
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the sake of vibe-coding purposes, can we move these details into the docstrings in the class implementation? Also, it seems the docs are out of date. The nice part about having it specifically in the doc strings (that get rendered by autodocs) is that the LLM will update the doc strings and the logic every iteration so it'll be easy to keep things maintained.

I think the examples/notebook might be out of date too?

Otherwise, I think we're pretty much there. Thank you for taking the time to iterate on this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The notebook is updated (I've been testing with it for every change in addtion to the unit tests), I'll poke the documentation and let you know, that probably is out of date. I don't mind moving it, the other documentation I just added is up to date.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rst is updated to resemble the other interpretability ones (sorry I didn't do that sooner) and I added the gist of what it had to the doc string in the code. Excellent call there and thank you for helping me make this much better.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
pyhealth.interpret.methods.basic_gradient
===========================================

Overview
--------

The BasicGradientSaliencyMaps method computes gradient-based saliency maps for PyHealth's image
classification models. This helps identify which regions of medical images most influenced the
model's prediction by visualizing gradients of model outputs with respect to input pixels.

For a complete working example, see:
``examples/ChestXrayClassificationWithSaliency.ipynb``

API Reference
-------------

.. autoclass:: pyhealth.interpret.methods.basic_gradient.BasicGradientSaliencyMaps
:members:
:undoc-members:
:show-inheritance:
:member-order: bysource
Loading