I have a two-tower model. Query model has info about the users such as user id and gender, and candidate model has item-related information item id, description etc.
How can I add user’s history (what item they viewed before) to the query model? How to integrate the item embeddings as history to the query model?
Hi @gulcek,
You can integrate the user’s history to query model. Here is the sample code to generate user history along item related information.
- Get the embeddings from Candidate model by passing embeddings.
- Aggregate the historical embeddings.
- Concatenate historical embedding with user data.
embeddings = candidate_model(item_ids)
agg_hist = tf.reduce_mean(embeddings, axis =1)
comb_data = tf.concat([user_features, agg_hist], axis = -1)
Finally fed this Concatenated data to your query model.
Thank You
1 Like