Created
February 18, 2017 22:00
-
-
Save Theo-/c469f3cf8700ae0af7891735a882ed79 to your computer and use it in GitHub Desktop.
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
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