Putting it all together

As before, we will show the entire neural network structure here. Note that this structure is for the version of the model that includes GloVe vectors:

def build_model(vocab_size, embedding_dim, sequence_length, embedding_matrix):    sequence_input = Input(shape=(sequence_length,), dtype='int32')    embedding_layer = Embedding(input_dim=vocab_size,                                output_dim=embedding_dim,                                weights=[embedding_matrix],                                input_length=sequence_length,                                trainable=False,                                name="embedding")(sequence_input)    x = Conv1D(128, 5, activation='relu')(embedding_layer)    x = MaxPooling1D(5)(x)    x = Conv1D(128, 5, activation='relu')(x)    x = MaxPooling1D(5)(x)    x = Conv1D(128, 5, activation='relu')(x)    x = GlobalMaxPooling1D()(x)    x = Dense(128, activation='relu' ...

Get Deep Learning Quick Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.