kundajelab / deeplift

Public facing deeplift repo
MIT License
818 stars 162 forks source link

How to use deeplift for regression #126

Open Comp-Engr18 opened 2 years ago

Comp-Engr18 commented 2 years ago

My last layer uses tanh activation function for continuous variable prediction like steering angle. What changes I need in deeplift to use deeplift for my scenario i.e., regression problem.

AvantiShri commented 2 years ago

Hi @Comp-Engr18, in theory you may not have to make changes; however this particular codebase was set up to work with a fairly old version of tensorflow/keras, and thus may not work with your model for that reason, so my first suggestion would be to look at the external implementations here: https://github.com/kundajelab/deeplift#my-model-architecture-is-not-supported-by-this-deeplift-implementation-what-should-i-do.

My second recommendation would be to compute the explanation with respect to the linear input that feeds into the tanh nonlinearity (i.e. what would be analogous to the logit of a sigmoid output) to avoid saturation effects (as discussed in the deeplift paper in the section "Choice of Target Layer"); however, that is a more subjective decision.