Skip to content

Instantly share code, notes, and snippets.

@hanneshapke hanneshapke/model.py
Last active Apr 16, 2018

Embed
What would you like to do?
Model definition for the CNN Visualization Demo
sequence_input = Input(shape=(maxlen_text,))
x = Embedding(name='embedding_layer',
input_dim=max_words_to_keep,
output_dim=token_vec_size,
input_length=maxlen_text)(sequence_input)
x = Dropout(.20)(x)
x = Conv1D(64, 5, activation='relu', name='1-conv1d', padding='same')(x)
x = MaxPooling1D(pool_size=4)(x)
x = Dropout(.20)(x)
x = Conv1D(64, 5, activation='relu', name='2-conv1d', padding='same')(x)
x = MaxPooling1D(pool_size=2)(x)
x = Dropout(.20)(x)
x = Flatten()(x)
output = Dense(units=output_dim,activation='softmax')(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.