Skip to content

Instantly share code, notes, and snippets.

@ravishchawla
Last active June 27, 2018 19:17
Show Gist options
  • Save ravishchawla/5cab89d94f6238e76dbfc1418719ebf6 to your computer and use it in GitHub Desktop.
Save ravishchawla/5cab89d94f6238e76dbfc1418719ebf6 to your computer and use it in GitHub Desktop.
model = Sequential();
model.add(Embedding(len(word_dict), max_cap, input_length=max_cap));
model.add(LSTM(100, return_sequences=True));
model.add(LSTM(100));
model.add(Dense(100, activation='relu'));
model.add(Dense(2, activation='softmax'));
print(model.summary());
optimizer = Adam(lr=0.001, decay=0.0001);
model.compile(loss='binary_crossentropy', optimizer=optimizer, metrics=['accuracy'])
# fit model
model.fit(X_train, Y_train, batch_size=128, epochs=10, validation_data=(X_dev, Y_dev))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment