Skip to Content
Deep Learning Quick Reference
book

Deep Learning Quick Reference

by Mike Bernico
March 2018
Intermediate to advanced
272 pages
7h 53m
English
Packt Publishing
Content preview from Deep Learning Quick Reference

Putting it all together

Now let's look at the entire network, now that we understand the parts. The network is shown in the following code for your reference:

def build_network(vocab_size, embedding_dim, sequence_length):    input = Input(shape=(sequence_length,), name="Input")    embedding = Embedding(input_dim=vocab_size,         output_dim=embedding_dim, input_length=sequence_length,          name="embedding")(input)    lstm1 = LSTM(10, activation='tanh', return_sequences=False,       dropout=0.2, recurrent_dropout=0.2, name='lstm1')(embedding)    output = Dense(1, activation='sigmoid', name='sigmoid')(lstm1)    model = Model(inputs=input, outputs=output)    model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])    return model

As we have with other ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Keras Deep Learning Cookbook

Keras Deep Learning Cookbook

Rajdeep Dua, Sujit Pal, Manpreet Singh Ghotra
Deep Learning with Keras

Deep Learning with Keras

Antonio Gulli, Sujit Pal

Publisher Resources

ISBN: 9781788837996Supplemental Content