How to pass metadata to nlp for better results

Hey, I am new to the world of machine learning. i was trying to find correct techniques/ technologies to learn for a specific use case.

I am interested in first finding ROI then using bounding boxes ocr + nlp to extract named entity. now i have some metadata that is useful for predicting the entity. i want to pass this to model to make more accurate results. i have seen vector database but not sure how to integrate it. because data is only relevant for some set of documents/ images i want it to have more weightage for that document.

Hi @maharshi, For passing the meta data to the model you have to create the multi-input models. To create a multi-input model you have to define 2 models where the first model input will be the reviews and the second model input will be the meta data. Now you will concatenate the output of the first model with the output of the second model to form a multi input model. For example,

#First model
embedding_layer = Embedding(vocab_size, 100, weights=[embedding_matrix], trainable=False)(input_1)
LSTM_Layer_1 = LSTM(128)(embedding_layer)

#Second model
dense_layer_1 = Dense(10, activation='relu')(input_2)
dense_layer_2 = Dense(10, activation='relu')(dense_layer_1)

#multi-input model
concat_layer = Concatenate()([LSTM_Layer_1, dense_layer_2])
dense_layer_3 = Dense(10, activation='relu')(concat_layer)
output = Dense(3, activation='softmax')(dense_layer_3)
model = Model(inputs=[input_1, input_2], outputs=output)

For model details please refer to this document. Thank You.

1 Like

sorry for py syntax question.
what this syntax mean when you call function after () again, or it have another use.
i am not prety with py yet

Hi @Sergey_Efimov, This is the functional API implementation of the model. Thank You.

@Kiran_Sai_Ramineni your answer is helpful thanks. for this i will need to train the model my self from ground up like this right ? or can i use some large dataset for features extraction and then train like this ? please have in mind that i am new to this, just gathering information so i know which direction i need to learn more.

Hi @maharshi, If there are any pre-trained models suitable for your use case you can use them else you can build your model from scratch. Thank You.