Retrieval using only one feature of User
See original GitHub issueI want to build deep recommender system to predict movie for a given user. I have dataset which contain information about user like its id, gender, city etc (dataset contain different rows for same user with different location city) and movie information like its title, genre etc. I can train the model using this dataset by having user information in query tower and movie information in candidate tower. But during retrieval, I only have information about user’s id(this user id is also in the dataset). How to give only user id embedding in BruteForce layer for predicting movie? Like in deep recommender model, we would write brute_force = tfrs.layers.factorized_top_k.BruteForce(model.query_model.embedding_model.user_embedding) but how to take this user’s past locations and its gender into context while retrieving as we are can’t pass whole query model?
Issue Analytics
- State:
- Created a year ago
- Comments:5

Top Related StackOverflow Question
@dexter1729
Yes, it’s the trained model. You are calculating the query vector based on a different dataset, containing only one row per user.
To pass multiple locations to the model you would need to modify it to accept an array of user locations and take the average vector. Since you have no such examples during training the results could be garbage. Alternatively you would take the most recent location for that user. In either case you will not be capturing the true user location at inference time and are therefore introducing training-serving skew. You can still give this a try depending on your use-case and requirements, but your results may vary. Again, the correct way to handle this is to serve these features to the model at inference time.
Here’s the general idea @dexter1729, I haven’t tested this so you may encounter some errors. As I mentioned, this removes the ability to pass different values to the query model at inference time. A user_id will be the only input.