Forked from nlothian/fasttext_plus_continous_keras.py
Created
February 1, 2018 10:56
-
-
Save loretoparisi/f15dc19aae46dc5b53e339a89c0d2b74 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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