Created
July 19, 2018 16:28
-
-
Save heukirne/99ef9308104123a58a670f0a7a9e9245 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.core import Dense, Activation | |
from keras.layers import Flatten, Dropout | |
from keras.layers.embeddings import Embedding | |
from keras.models import Sequential | |
embedding_layer = Embedding(embedding_weights.shape[0], | |
embedding_weights.shape[1], | |
weights=[embedding_weights], | |
input_length=max_length) | |
model = Sequential() | |
model.add(embedding_layer) | |
model.add(Flatten()) | |
model.add(Dense(128, activation='linear')) | |
model.add(Dropout(0.5)) | |
model.add(Dense(1)) | |
model.add(Activation('linear')) | |
model.compile(loss='mean_absolute_error', optimizer='sgd',metrics=['mae']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment