tensorflow / tensorflow/recommenders
Save & Serve tfrs that does not recommend items previously interacted with using BruteForce layer
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2k
- Forks
- 300
- PR merge metrics
- No merged PRs in 30d
Description
I am working with a relatively small data set and am noticing that users are being recommended a lot of items they have previously interacted with and I would like to pre-filter out these items before saving and serving the mode on ai platform. I realize this could also be done after the list has been generated, but the way our app works makes it rather difficult (and slow) to filter post hoc on the client side.
I have seen a few other issues addressing related questions (e.g., 307, 113). However, I have not seen a definitive solution, and these seem to deal with either excluding a set of items for all users (rather than a unique set for each user), or excluding items from test recommendations.
Currently, I generate an index with 80 recommended items: index = tfrs.layers.factorized_top_k.BruteForce(model.user_model, k = 80)
and then remove any duplicates that existed in the training df:
index.index_from_dataset(
tf.data.Dataset.zip((unique_recipe_id_pred.batch(80), unique_recipe_id_pred.batch(80).map(model.recipe_model))))
This works well, but how could I also exclude items in the index that users have interacted with? Could the query with exclusions function be a possible solution?
Apologies if I have missed something here and thanks in advance for any advice!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the tfrs.layers.factorized_top_k.BruteForce index and the TopK query with exclusions API referenced in the issue. Determine whether per-user interaction sets can be applied before serving on AI Platform, and verify that recommendations exclude each user's previously interacted items without client-side post-processing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, tensorflow
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100