Skip to content

Instantly share code, notes, and snippets.

@mayurmorin
Created November 10, 2019 10:24
Show Gist options
  • Save mayurmorin/0192afb02dc343fe0d87dc014bcbd0b6 to your computer and use it in GitHub Desktop.
Save mayurmorin/0192afb02dc343fe0d87dc014bcbd0b6 to your computer and use it in GitHub Desktop.
from keras.layers import Embedding, LSTM, Dense, Dropout, Lambda, Flatten
from keras.models import Sequential, load_model, model_from_config
import keras.backend as K
def get_model():
"""Define the model."""
model = Sequential()
model.add(LSTM(300, dropout=0.4, recurrent_dropout=0.4, input_shape=[1, 300], return_sequences=True))
model.add(LSTM(64, recurrent_dropout=0.4))
model.add(Dropout(0.5))
model.add(Dense(1, activation='relu'))
model.compile(loss='mean_squared_error', optimizer='rmsprop', metrics=['mae'])
model.summary()
return model
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment