[P] Combining numerical and text features in (deep) neural networks in keras
Hi folks,
A lot of people ask how to combine NLP based features (or in general sequence embeddings) with standart features. In keras it pretty easy with a multiple input modell:
nlp_input = Input(shape=(seq_length,), name='nlp_input') meta_input = Input(shape=(10,), name='meta_input') emb = Embedding(output_dim=embedding_size, input_dim=100, input_length=seq_length)(nlp_input) nlp_out = Bidirectional(LSTM(128, dropout=0.3, recurrent_dropout=0.3, kernel_regularizer=regularizers.l2(0.01)))(emb) x = concatenate([nlp_out, meta_input]) x = Dense(classifier_neurons, activation='relu')(x) x = Dense(1, activation='sigmoid')(x) model = Model(inputs=[nlp_input , meta_input], outputs=[x])
Here is a link, where it more detailed.
Cheers
submitted by /u/ixeption
[link] [comments]