tensorflow / tensorflow/recommenders

[Question] Item-to-Item recommendations with the candidate model

Open
#575 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2k
Forks
300
PR merge metrics
No merged PRs in 30d

Description

Hi !

On the retrieval tutorial page, item-to-item recommendations are mentionned at the end of the page. The paragraph suggests to use items for both towers and then train model with pair items.

I was wondering in the case where we don't have those kind of data still available, is it possible to do item-to-item recommendations with a query tower trained with users by just using the trained candidate tower in the BruteForce (see code below) ? I experienced this and results seem correct.

index_items = tfrs.layers.factorized_top_k.BruteForce(model.candidate_model, 200)
index_items.index_from_dataset(
    items.batch(100).map(lambda x: (x["id_house"], model.candidate_model({
                    "id_house": x["id_house"],
                    "type_logement": x["type_logement"],
                    "confort": x["confort"],
                    "capacity": x["capacity"] }))))

I assume I can get recommended items from different categories since different items could be of the same interest for same users and then be close in the embedding. To filter results, I simply put some filters behind the results according to the item alongside recommendations are displayed. This is maybe not the most effecient or cleanest way to proceed, but this seem to work as a simple solution.

So, my questions are what is your opinion about this approach ? Should the query and candidate towers always be used together as they are trained together ?

Thanks in advance for your time !
Jérémy

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the retrieval tutorial page linked in the issue and the BruteForce entry point shown in the example. Compare how the candidate and query towers are used, then document the supported approach and its limitations so the tutorial answers the item-to-item recommendation question.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, tensorflow
Domain
machine-learning
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.