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 ...