Skip to content

Change hook-based non-linearity replacement to module-swap-based. #805

Merged
jhnwu3 merged 4 commits intosunlabuiuc:masterfrom
Logiquo:better_deeplift_gim
Jan 31, 2026
Merged

Change hook-based non-linearity replacement to module-swap-based. #805
jhnwu3 merged 4 commits intosunlabuiuc:masterfrom
Logiquo:better_deeplift_gim

Conversation

@Logiquo
Copy link
Copy Markdown
Collaborator

@Logiquo Logiquo commented Jan 31, 2026

Contributor: Yongda Fan (yongdaf2@illinois.edu)

Contribution Type: Interpretability

Description
Originally the DeepLift & GIM requires the model to have hook to replace the activation function, which is both cumbersome and error-prone (e.g. the old stagenet_mha forget to add a hook for one of the softmax).

The new method only requires that all model non-linearity is defined as nn.Module, and DeepLift and GIM will dynamtically swap them if needed. This makes both the model definination cleanear and fix a few small issues regarding GIM with stagenet attn.

@Logiquo Logiquo added component: interpret Contribute a new interpretability method to PyHealth enhancement New feature or request labels Jan 31, 2026
@Logiquo Logiquo requested a review from jhnwu3 January 31, 2026 07:48
@Logiquo
Copy link
Copy Markdown
Collaborator Author

Logiquo commented Jan 31, 2026

This has also been tested on the mortality prediction stagenet mimic4 interpretability experiment and gives the same numbers

Copy link
Copy Markdown
Collaborator

@jhnwu3 jhnwu3 left a comment

Choose a reason for hiding this comment

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

lgtm

@jhnwu3 jhnwu3 merged commit cbb7d0e into sunlabuiuc:master Jan 31, 2026
1 check passed
@Logiquo Logiquo deleted the better_deeplift_gim branch February 4, 2026 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: interpret Contribute a new interpretability method to PyHealth enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants