sicara / tf-explain

Interpretability Methods for tf.keras models with Tensorflow 2.x
https://tf-explain.readthedocs.io
MIT License
1.02k stars 112 forks source link

Implementing tf-explain for regression using CNN #145

Open ishita-gupta0810 opened 4 years ago

ishita-gupta0810 commented 4 years ago

Most of the functions such as GradCAM ,smoothGrad and others require us to provide a class index as well. Incase we use a CNN model with a linear activation layer with 1 node, so as to implement a regression model. How would we use tf-explain for the visualisation ?

danvargg commented 3 years ago

+1

Ram-WD commented 2 years ago

+1

showkeyjar commented 2 years ago

+1

Corne173 commented 2 years ago

I've found some success in implementing a regression model for a univariate time series model. The grad-cam model showed that a certain region was important. I shortened the input sequence to exclude that region and found that my model's performance got significantly worse.

Yes this did require retraining of the model and you can argue that it changes the model and thus you can't make comparisons.

But then I added a longer input sequence, retrained model again and found that the grad cam highlighted the same features/region as the original model and didn't find important features in the longer sequence. Consequently, the model accuracy did not increase with the added length to the sequence.

Conclusion - By no means was this rigorously proven, but the grad-cam for time series that was implemented looks like it reflects feature importance.