Skip to content

Instantly share code, notes, and snippets.

@hanneshapke
Last active April 16, 2018 02:42
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 hanneshapke/39af6a4d4c6a389ebbe5e6f3e29d5496 to your computer and use it in GitHub Desktop.
Save hanneshapke/39af6a4d4c6a389ebbe5e6f3e29d5496 to your computer and use it in GitHub Desktop.
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