Skip to content

Instantly share code, notes, and snippets.

@mohdsanadzakirizvi
Last active August 7, 2019 02:51
Show Gist options
  • Save mohdsanadzakirizvi/e26fddbe34b12371ea9adeeeb118a884 to your computer and use it in GitHub Desktop.
Save mohdsanadzakirizvi/e26fddbe34b12371ea9adeeeb118a884 to your computer and use it in GitHub Desktop.
# define model
model = Sequential()
model.add(Embedding(vocab, 50, input_length=30, trainable=True))
model.add(GRU(150, recurrent_dropout=0.1, dropout=0.1))
model.add(Dense(vocab, activation='softmax'))
print(model.summary())
# compile the model
model.compile(loss='categorical_crossentropy', metrics=['acc'], optimizer='adam')
# fit the model
model.fit(X_tr, y_tr, epochs=100, verbose=2, validation_data=(X_val, y_val))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment