Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save loretoparisi/f15dc19aae46dc5b53e339a89c0d2b74 to your computer and use it in GitHub Desktop.
Save loretoparisi/f15dc19aae46dc5b53e339a89c0d2b74 to your computer and use it in GitHub Desktop.
inp = Input(shape=(maxlen,), name="text_input") # featureized text comes in here
x = Embedding(embedding_matrix.shape[0], embed_size, weights=[embedding_matrix], trainable=True)(inp)
x = Dense(some_num_here, activation="relu")(x)
extra_data = Input(shape=(1,), name="extra_data") # your continous features comes in here
combined = concatenate([x, extra_data])
# maybe some ReLu + Dropout here
out = Dense(num_classes, activation="sigmoid")(combined)
model = Model(inputs=[inp, extra_data], outputs=out)
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment