Skip to content

Instantly share code, notes, and snippets.

@Theo-
Created February 18, 2017 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Theo-/c469f3cf8700ae0af7891735a882ed79 to your computer and use it in GitHub Desktop.
Save Theo-/c469f3cf8700ae0af7891735a882ed79 to your computer and use it in GitHub Desktop.
from keras.layers import LSTM, Convolution1D, Flatten, Dropout, Dense
from keras.layers.embeddings import Embedding
from keras.models import Sequential
max_review_length = 1600
embedding_vecor_length = 300
model = Sequential()
model.add(Embedding(top_words, embedding_vecor_length, input_length=max_review_length))
model.add(Convolution1D(64, 3, border_mode='same'))
model.add(Convolution1D(32, 3, border_mode='same'))
model.add(Convolution1D(16, 3, border_mode='same'))
model.add(Flatten())
model.add(Dropout(0.2))
model.add(Dense(180,activation='sigmoid'))
model.add(Dropout(0.2))
model.add(Dense(1,activation='sigmoid'))
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment