albermax / innvestigate

A toolbox to iNNvestigate neural networks' predictions!
Other
1.25k stars 234 forks source link

[WIP:] refactoring for tensorflow2 keras compat #229

Open mrslacklines opened 3 years ago

mrslacklines commented 3 years ago

I was using the Innvestigate library to perform LRP analysis of my Temporal Convolutional Network that I use for predicting fundamental frequency of speech from thousands of linguistic features. The visualisations allow me to see the relevance of feature groups (like type of syllable accent and syllable position) for intonation contours. The algorithm in Innvestigate is great and quite speedy but I found it difficult to use directly with my Tensorflow 2.0 Keras Sequential network. The reason is mainly in the import statements that you use. This PR is a potential discussion starter as I think it would be much better not to import libraries as whole paths, i.e. instead of importing tensorflow.keras.layers.convolutional.UpSampling1D we should probably just import UpSampling1D. Also the eager execution setting in TF and the way I have implemented in my scripts do not allow some operations on tensors like list comprehensions etc. (AFAIK they are simply not yet implemented in the TF API).

If you think this is helpful at all please let me know and I will be happy to help tidy this up or we can discuss this further.

Anyways, thanks you for a great library!