merge_conversion function

101 views
Skip to first unread message

Beibei Xin

unread,
Jan 11, 2017, 2:45:57 PM1/11/17
to DeepLIFT Users
Hi Avanti,

Recently we tried to use your deeplift v0.4.0 on our deeplift models with single input, it works pretty well. However, for models with multiple inputs, do we need a function like merge_conversion in keras_conversion.py? In this case, the previous layer of joint layer is  Merge layer, which was not successfully converted in our trial. Many thanks for your support and help.

Happy New Year,
Beibei

Avanti Shrikumar

unread,
Jan 11, 2017, 2:51:08 PM1/11/17
to Beibei Xin, DeepLIFT Users
Hi Beibei,

If you are using merge layers with a sequential model, then yes we would need to implement a conversion function for Merge layers. However, it is possible to have multiple inputs using a Graph model (which has been deprecated in more recent version of keras). Are you still using keras 0.2? Can you post the architecture of the model with the Merge layer?

Regards,
Avanti

--
You received this message because you are subscribed to the Google Groups "DeepLIFT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to deeplift+unsubscribe@googlegroups.com.
To post to this group, send email to deep...@googlegroups.com.
Visit this group at https://groups.google.com/group/deeplift.
To view this discussion on the web visit https://groups.google.com/d/msgid/deeplift/32d35e34-06e2-4c6f-bd0e-f290e7e29493%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Beibei Xin

unread,
Jan 11, 2017, 3:51:12 PM1/11/17
to DeepLIFT Users, ava...@stanford.edu
Hi Avanti,

Yes, I am still using keras 0.2 and a Graph model. Here is the rough architecture of our model. Please let me know if you need more detailed one.

Thank you very much,
Beibei


On Wednesday, January 11, 2017 at 11:51:08 AM UTC-8, Avanti Shrikumar wrote:
Hi Beibei,

If you are using merge layers with a sequential model, then yes we would need to implement a conversion function for Merge layers. However, it is possible to have multiple inputs using a Graph model (which has been deprecated in more recent version of keras). Are you still using keras 0.2? Can you post the architecture of the model with the Merge layer?

Regards,
Avanti
On 11 January 2017 at 11:45, Beibei Xin <xinbei...@gmail.com> wrote:
Hi Avanti,

Recently we tried to use your deeplift v0.4.0 on our deeplift models with single input, it works pretty well. However, for models with multiple inputs, do we need a function like merge_conversion in keras_conversion.py? In this case, the previous layer of joint layer is  Merge layer, which was not successfully converted in our trial. Many thanks for your support and help.

Happy New Year,
Beibei

--
You received this message because you are subscribed to the Google Groups "DeepLIFT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to deeplift+u...@googlegroups.com.

Avanti Shrikumar

unread,
Jan 11, 2017, 4:42:51 PM1/11/17
to Beibei Xin, DeepLIFT Users
Ah, got it. Is the merge mode "concat"? I've implemented a Concat layer (https://github.com/kundajelab/deeplift/blob/master/deeplift/blobs/core.py#L696-L719) but I haven't implemented the conversion function yet. I can do that.

To unsubscribe from this group and stop receiving emails from it, send an email to deeplift+unsubscribe@googlegroups.com.

To post to this group, send email to deep...@googlegroups.com.
Visit this group at https://groups.google.com/group/deeplift.

Beibei Xin

unread,
Jan 11, 2017, 7:15:27 PM1/11/17
to DeepLIFT Users, ava...@stanford.edu
Hi Avanti,

Yes, the merge mode is "concat". I saw you have Concat layer there. It would be very helpful if you can implement that. 

Beibei

Beibei Xin

unread,
Feb 10, 2017, 1:30:24 PM2/10/17
to DeepLIFT Users, Avanti Shrikumar
Hi Avanti,

Hope this email find you well. I saw your recent paper on reverse-complement parameter sharing which will further guide genomic study using deep CNNs. DeepLIFT is already very helpful in interpreting deep CNNs, look forward to your update on multimodal version of DeepLIFT. Please let me know if you need more information.

Thank you very much,
Beibei
You received this message because you are subscribed to a topic in the Google Groups "DeepLIFT Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/deeplift/bJz139BmuYw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to deeplift+unsubscribe@googlegroups.com.

To post to this group, send email to deep...@googlegroups.com.
Visit this group at https://groups.google.com/group/deeplift.

Avanti Shrikumar

unread,
Feb 10, 2017, 1:53:18 PM2/10/17
to Beibei Xin, DeepLIFT Users
Hi Beibei,

Yes, sorry for the delay; I was busy with both that paper and another upcoming paper deadline. I will try to implement the multimodal support this weekend, after I complete a draft of the second paper.

To unsubscribe from this group and all its topics, send an email to deeplift+u...@googlegroups.com.

To post to this group, send email to deep...@googlegroups.com.
Visit this group at https://groups.google.com/group/deeplift.

--
You received this message because you are subscribed to the Google Groups "DeepLIFT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to deeplift+u...@googlegroups.com.
To post to this group, send email to deep...@googlegroups.com.
Visit this group at https://groups.google.com/group/deeplift.

For more options, visit https://groups.google.com/d/optout.
--
Sent from my phone, please excuse brevity/typos

Beibei Xin

unread,
Feb 14, 2017, 5:51:58 PM2/14/17
to Avanti Shrikumar, DeepLIFT Users
Hi Avanti,

Thanks for your prompt response! Hope everything goes smoothly with your second paper, look forward to reading it. Just let me know if you need any extra information in implementing multimodal support. 

Thank you,
Beibei

To unsubscribe from this group and all its topics, send an email to deeplift+unsubscribe@googlegroups.com.

To post to this group, send email to deep...@googlegroups.com.
Visit this group at https://groups.google.com/group/deeplift.
To view this discussion on the web visit https://groups.google.com/d/msgid/deeplift/3fa6b6e2-85e7-460a-8e39-1ff0f057bc0c%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "DeepLIFT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to deeplift+unsubscribe@googlegroups.com.

Avanti Shrikumar

unread,
Mar 6, 2017, 2:31:54 AM3/6/17
to Beibei Xin, DeepLIFT Users
Hi Beibei,

Thank you for your patience. I have implemented functionality for autoconverting Graph models that have merge layers (with merge_mode='concat' - let me know if you are using a different merge mode) and have tested it using keras 0.2 and 0.3. The implementation is currently on the master branch of the public DeepLIFT repo and I would appreciate it if you could try it out. Here is a summary of the functionality:

from deeplift.conversion import keras_conversion as kc
deeplift_model = kc.convert_graph_model(model=your_keras_graph_model)
deeplift_contribs_func = deeplift_model.get_target_contribs_func(
    find_scores_layer_name=["name_of_mode_1", "name_of_mode_2"],
    pre_activation_target_layer_name="name_of_layer_to_compute_contributions_to")
scores = deeplift_contribs_func(
          task_idx=0, #replace this with index of task of interest
          input_data_list={'name_of_mode_1': data_for_mode_1,
                           'name_of_mode_2': data_for_mode_2},
          #if references are not provided, will default to a reference
          #of all-zeros
          input_references_list={'name_of_mode_1': references_for_mode_1,
                                 'name_of_mode_2': references_for_mode_2},
          batch_size=100, progress_update=None)
scores_for_mode_1 = scores[0]
scores_for_mode_2 = scores[1]

What's new here is that you can now supply a list of layer names to find_scores_layer_name (eg: one for each input mode), and the output will be a list of deeplift scores (one for each layer). As before, you can also just supply one layer name (not in a list), and the output will be the deeplift scores for just that layer. You can also look at the test written in https://github.com/kundajelab/deeplift/blob/master/tests/conversion/graph/test_concat_model.py

Please let me know if you have any issues!
- Avanti

Reply all
Reply to author
Forward
0 new messages