kundajelab / dragonn

A toolkit to learn how to model and interpret regulatory sequence data using deep learning.
http://kundajelab.github.io/dragonn/
MIT License
254 stars 71 forks source link

SequenceDNN intuition #44

Closed rbharath closed 6 years ago

rbharath commented 6 years ago

I've been working on porting the dragonn tutorial over to deepchem (https://github.com/deepchem/deepchem/pull/979) and have run into a couple basic issues about shapes and convolutions.

At the first layer, the SequenceDNN performs a keras.layers.Conv2D(nb_filter=1, nb_row=4, nb_col=15) (assuming conv_width of 15 and nb_filter=1). The training data generated in the tutorial forms an array of shape (n_samples, 1, 4, 1000) (assuming seq_length=1000). I think what's happening is that the genome is being viewed as an image of shape (4, 1000) with 1 channel, and the convolution of shape (4,15) is moved over this image.

Is this summary right? If so, is the image_data_format option in Keras set to channels_first somewhere to account for the data channel being before the width/height in the array shape?

jisraeli commented 6 years ago

@rbharath Your summary is spot on. For keras 0.3.3, the default image format should be th which uses channels first. For a more recent keras, this needs to be set. Would be good to clarify this in the installation instructions or configuring this as part of the installation.

rbharath commented 6 years ago

Ah, I see. Thanks for the clarification!