Skip to content

Instantly share code, notes, and snippets.

@sid321axn
Created August 7, 2020 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sid321axn/6576b7f2e7ca04c7bb894ef67f207f87 to your computer and use it in GitHub Desktop.
Save sid321axn/6576b7f2e7ca04c7bb894ef67f207f87 to your computer and use it in GitHub Desktop.
print('Building model...')
# create an LSTM network with a single LSTM
input_ = Input(shape=(MAX_SEQUENCE_LENGTH,))
x = embedding_layer(input_)
# x = LSTM(15, return_sequences=True)(x)
x = Bidirectional(LSTM(15, return_sequences=True))(x)
x = GlobalMaxPool1D()(x)
output = Dense(1, activation="sigmoid")(x)
model = Model(input_, output)
model.compile(
loss='binary_crossentropy',
optimizer=Adam(lr=0.01),
metrics=['accuracy']
)
model.summary()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment