Skip to content

Instantly share code, notes, and snippets.

@FedericoV
Created March 25, 2016 20:17
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 FedericoV/05ad9af84a0ff192187c to your computer and use it in GitHub Desktop.
Save FedericoV/05ad9af84a0ff192187c to your computer and use it in GitHub Desktop.
conv_model = Sequential()
conv_model.add(Embedding(max_features, embedding_size, input_length=maxlen))
conv_model.add(Dropout(0.25))
conv_model.add(Convolution1D(nb_filter=nb_filter,
filter_length=filter_length,
border_mode='valid',
activation='relu',
subsample_length=1))
conv_model.add(MaxPooling1D(pool_length=pool_length))
conv_model.add(LSTM(lstm_output_size))
conv_model.add(Dense(128, activation='relu'))
conv_model.add(Dropout(0.5))
conv_model.add(Dense(1, activation='sigmoid'))
conv_model.compile(loss='binary_crossentropy',
optimizer=rms, class_mode="binary")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment