Created
January 26, 2019 18:07
-
-
Save ashokc/9c185b8db93c744271e579fbac015eb0 to your computer and use it in GitHub Desktop.
A simple model for LSTM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A Simple Model for LSTM | |
model = keras.models.Sequential() | |
embedding = keras.layers.embeddings.Embedding(input_dim=len(kTokenizer.word_index)+1, output_dim=300, input_length=sequenceLength, trainable=True, mask_zero=True) | |
model.add(embedding) | |
model.add(keras.layers.LSTM(units=150, dropout=0.2, recurrent_dropout=0.2, return_sequences=False)) | |
model.add(keras.layers.Dense(numClasses, activation='softmax')) | |
model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['acc']) | |
print(model.summary()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment