-
Notifications
You must be signed in to change notification settings - Fork 476
Basic gradient saliency visualization #594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
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 3bd6860
Updating function name for consistency and adding to the _init_.py
Nimanui ce1e510
Created using Colab
Nimanui 8eb57eb
Example of using gradient saliency
Nimanui b376b8a
Delete Colab ChestXrayClassificationWithSaliency.ipynb
Nimanui 0e14d97
Merge branch 'sunlabuiuc:master' into master
Nimanui 57e2c3c
Adding a basic gradient saliency method that functions on the pyhealt…
Nimanui 997db4a
Updating function name for consistency and adding to the _init_.py
Nimanui 1c13529
Merge branch 'sunlabuiuc:master' into master
Nimanui 5c88fbc
Merge branch 'master' into SaliencyMappingGradient
Nimanui 9efd00e
Merge branch 'sunlabuiuc:master' into master
Nimanui 6aeeb69
Merge branch 'master' into SaliencyMappingGradient
Nimanui f3f905e
Moving the saliency module to the "interpret\methods" folder
Nimanui 15d62db
Created using Colab
Nimanui f98ecf8
Small bug fix and adjusting the ipynb example
Nimanui 83d9412
Add files via upload
Nimanui 470f54a
Created using Colab
Nimanui 1f1628c
Locally run notebook example to remove collab dependency
Nimanui 28c48fc
Add files via upload
Nimanui f6487f9
Add files via upload
Nimanui 3a97db7
Add files via upload
Nimanui 64a940a
Delete examples/ChestXrayClassificationWithSaliencyMapping.ipynb
Nimanui 0b45143
Merge branch 'sunlabuiuc:master' into SaliencyMappingGradient
Nimanui 3dbaa83
Delete ChestXrayClassificationWithSaliencyMapping.ipynb
Nimanui d3c320d
Update repository references in notebook
Nimanui e9d9d9e
Adding saliency class and adjusting code to use the class
Nimanui 5e5fcd6
Merge pyhealth main
Nimanui 1c1e912
Adding saliency class and adjusting code to use the class
Nimanui 862b1c4
Refactoring methods in saliency.py
Nimanui 1a5b8c9
Some refactoring and adding better batch handling
Nimanui 47b2c39
Adding some documentation
Nimanui 2d8e6d0
Merge remote-tracking branch 'upstream/master' into SaliencyMappingClass
Nimanui e159318
Basic Gradient imagery: removing dataload options
Nimanui 8041c09
Merge remote-tracking branch 'upstream/master' into SaliencyMappingClass
Nimanui 1240716
Adding base_interpreter inheritance and testing
Nimanui 755289b
Removing redundant code and the lazy initialization
Nimanui e051d30
Making the input_batch optional and adding support to update it with …
Nimanui e2b65e2
Adding a few unit tests
Nimanui b9accc0
Adding some documentation
Nimanui 26ebc71
Documentation updates
Nimanui File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
docs/api/interpret/pyhealth.interpret.methods.basic_gradient.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.