Created
May 2, 2017 08:56
-
-
Save dbonadiman/9fbdb2454e07e631003a6e4e5faf140a 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
x = Input(shape=(max_len,)) | |
emb = Embedding(max_features, | |
embedding_dims, | |
input_length=max_len))(x) | |
for filter_len in [2, 3, 4]: | |
branch = Sequential() | |
branch.add(Convolution1D(nb_filter=filters, | |
filter_length=filter_len, | |
border_mode='valid', | |
activation='relu', | |
subsample_length=subsample_length, | |
input_shape=(max_len, embedding_dims)) | |
branch.add(MaxPooling1D(pool_length=pooling_length)) | |
branch.add(Flatten()) | |
branches.append(branch(emb)) | |
merged = Merge(branches, mode='concat') | |
y = Dense(1, activation='sigmoid')(merged) | |
model = Model(inputs=x, outputs=y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment