deeplift icon indicating copy to clipboard operation
deeplift copied to clipboard

The Average layer

Open jessieren opened this issue 6 years ago • 1 comments

Hi Avanti and others,

Thank you very much for this great package. I would like to use your package to compute the feature contribution for my research problem. I used Keras functional API. So I believe I should use the following command to convert the model:

deeplift_model = kc.convert_functional_model(model,nonlinear_mxts_mode=deeplift.blobs.NonlinearMxtsMode.DeepLIFT_GenomicsDefault)

In my model, I used an average layer like this "output = Average()([input1, input2])". Based on my understanding, it seems there is no corresponding conversion function in your package for the layer "Average". Is that true? I could have replaced it with the merge function, like this output = merge([input1, input2], mode='ave'), but I found (1) though you have the conversion function for the merge layer, that is only for merge in the concatenate mode in your package, (2) I got an warning message that "the merge function is deprecated and will be removed after 08/2017. Use instead layers from keras.layers.merge, e.g. add, concatenate, etc.".

Is my understanding correct? If yes, do you mind adding a conversion function for the "Average" layer?

If not, please let me know if I misunderstood anything.

Thank you very much for your help. I really appreciate your great work.

Best wishes, Jessie

jessieren avatar Sep 08 '17 00:09 jessieren

Hello, I'm sorry I never responded to this issue - 2017 was a tough year for me personally. I'm coming across it now as I'm looking over old issues that I missed. It is true that the deeplift implementation doesn't support this layer, mostly because there have since been subsequent implementations of the DeepLIFT method (e.g. DeepSHAP, DeepExplain, PyTorch Captum) that can handle more flexible architectures (the downside of these flexible implementations is that they do not support the RevealCancel rule). For anyone coming across this issue via google search, there is a section in the FAQ about these alternative implementations: https://github.com/kundajelab/deeplift#my-model-architecture-is-not-supported-by-this-deeplift-implementation-what-should-i-do

I probably don't have bandwidth to keep adding features to the core deeplift code base as I've actually switched fields to work in Earth System Science - however, if someone is very keen to use the RevealCancel rule but their particular architecture is not supported in this codebase, I would be happy to provide guidance on how to add the required layer to this codebase.

AvantiShri avatar Oct 23 '20 07:10 AvantiShri