{"action":"created","issue":{"url":"https://api.github.com/repos/maxhodak/keras-molecules/issues/4","repository_url":"https://api.github.com/repos/maxhodak/keras-molecules","labels_url":"https://api.github.com/repos/maxhodak/keras-molecules/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/maxhodak/keras-molecules/issues/4/comments","events_url":"https://api.github.com/repos/maxhodak/keras-molecules/issues/4/events","html_url":"https://github.com/maxhodak/keras-molecules/issues/4","id":185235632,"number":4,"title":"Architecture issues","user":{"login":"fchollet","id":710255,"avatar_url":"https://avatars.githubusercontent.com/u/710255?v=3","gravatar_id":"","url":"https://api.github.com/users/fchollet","html_url":"https://github.com/fchollet","followers_url":"https://api.github.com/users/fchollet/followers","following_url":"https://api.github.com/users/fchollet/following{/other_user}","gists_url":"https://api.github.com/users/fchollet/gists{/gist_id}","starred_url":"https://api.github.com/users/fchollet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fchollet/subscriptions","organizations_url":"https://api.github.com/users/fchollet/orgs","repos_url":"https://api.github.com/users/fchollet/repos","events_url":"https://api.github.com/users/fchollet/events{/privacy}","received_events_url":"https://api.github.com/users/fchollet/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-25T21:13:22Z","updated_at":"2016-10-25T21:14:07Z","closed_at":null,"body":"Reading your code:\r\n\r\n```python\r\n\r\n    def create(self,\r\n               charset,\r\n               original_dim = 120,\r\n               epsilon_std = 0.01,\r\n               latent_rep_size = 292,\r\n               weights_file = None):\r\n        charset_length = len(charset)\r\n        \r\n        x = Input(shape=(original_dim, charset_length))\r\n        h = Convolution1D(9, 9, input_dim=60)(x)\r\n        h = Convolution1D(9, 9)(h)\r\n        h = Convolution1D(10, 11)(h)\r\n        h = Flatten()(h)\r\n        h = Dense(435)(h)\r\n        z_mean = Dense(latent_rep_size, name='z_mean')(h)\r\n        z_log_var = Dense(latent_rep_size, name='z_log_var')(h)\r\n\r\n        def sampling(args):\r\n            z_mean, z_log_var = args\r\n            batch_size = K.shape(z_mean)[0]\r\n            epsilon = K.random_normal(shape=(batch_size, latent_rep_size), mean=0., std=epsilon_std)\r\n            return z_mean + K.exp(z_log_var / 2) * epsilon\r\n\r\n        z = Lambda(sampling)([z_mean, z_log_var])\r\n\r\n        h = Dense(latent_rep_size, name='latent_input')(z)\r\n        h = RepeatVector(original_dim)(h)\r\n        h = GRU(501, return_sequences = True)(h)\r\n        h = GRU(501, return_sequences = True)(h)\r\n        h = GRU(501, return_sequences = True)(h)\r\n        decoded_mean = TimeDistributedDense(charset_length, activation='softmax', name='decoded_mean')(h)\r\n\r\n        def vae_loss(x, x_decoded_mean):\r\n            x = K.flatten(x)\r\n            x_decoded_mean = K.flatten(x_decoded_mean)\r\n            xent_loss = original_dim * objectives.binary_crossentropy(x, x_decoded_mean)\r\n            kl_loss = - 0.5 * K.mean(1 + z_log_var - K.square(z_mean) - K.exp(z_log_var), axis = -1)\r\n            return xent_loss + kl_loss\r\n        \r\n        encoded_input = Input(shape=(original_dim, latent_rep_size))\r\n        \r\n        self.autoencoder = Model(x, decoded_mean)\r\n        self.encoder = Model(x, z_mean)\r\n        #self.decoder = Model(self.autoencoder.get_layer('latent_input')(encoded_input),\r\n        #                     self.autoencoder.get_layer('decoded_mean')(encoded_input))\r\n```\r\n\r\n- What you call `original_dim` should actually be called something like `max_length`\r\n- You pass an `input_dim` argument to the first conv layer, this is not necessary (you already have an Input layer and you're using the functional API anyway)\r\n- Your conv layers do not have activations! You should add an argument `activation='relu'` to all of them.\r\n- Same for most of your `Dense`layers. Except these two, for which a linear layer makes sense:\r\n\r\n```python\r\nz_mean = Dense(latent_rep_size, name='z_mean')(h)\r\nz_log_var = Dense(latent_rep_size, name='z_log_var')(h)\r\n```"},"comment":{"url":"https://api.github.com/repos/maxhodak/keras-molecules/issues/comments/256177894","html_url":"https://github.com/maxhodak/keras-molecules/issues/4#issuecomment-256177894","issue_url":"https://api.github.com/repos/maxhodak/keras-molecules/issues/4","id":256177894,"user":{"login":"fchollet","id":710255,"avatar_url":"https://avatars.githubusercontent.com/u/710255?v=3","gravatar_id":"","url":"https://api.github.com/users/fchollet","html_url":"https://github.com/fchollet","followers_url":"https://api.github.com/users/fchollet/followers","following_url":"https://api.github.com/users/fchollet/following{/other_user}","gists_url":"https://api.github.com/users/fchollet/gists{/gist_id}","starred_url":"https://api.github.com/users/fchollet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fchollet/subscriptions","organizations_url":"https://api.github.com/users/fchollet/orgs","repos_url":"https://api.github.com/users/fchollet/repos","events_url":"https://api.github.com/users/fchollet/events{/privacy}","received_events_url":"https://api.github.com/users/fchollet/received_events","type":"User","site_admin":false},"created_at":"2016-10-25T21:14:07Z","updated_at":"2016-10-25T21:14:07Z","body":"Also the commented-out line for the decoder could not work. Setting up the decoder requires access to every intermediate layer between `z_mean` and `decoded_mean`."}}
{"actor":{"display_login":"fchollet"}}