Created
July 6, 2019 23:28
-
-
Save leigh-johnson/8acedbeaf2498212e651840d858abbaf to your computer and use it in GitHub Desktop.
Comparsing TensorFlow vs Keras for an LSTM model
This file contains hidden or 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
from keras.layers import LSTM | |
model = Sequential() | |
model.add(Embedding(max_features, 256, input_length=maxlen)) | |
model.add(LSTM(output_dim=128, activation='sigmoid', inner_activation='hard_sigmoid')) | |
model.add(Dropout(0.5)) model.add(Dense(1)) | |
model.add(Activation('sigmoid')) | |
model.compile(loss='binary_crossentropy', optimizer='rmsprop', metrics=['accuracy']) | |
model.fit(X_train, Y_train, batch_size=16, nb_epoch=10) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment