tensorflow / tensorflow/recommenders

Question on "in batch softmax" and retrieval task

Open
#279 2 comments 0 reactions 1 assignee View on GitHub

@maciejkula is already working on this.

Since Apr 27, 2021.

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

Description

Hi,

Thanks all for this awesome library ! I have a question regarding the retrieval task and the way it's implemented. From what I understand from the source code, the retrieval task uses CategoricalCrossEntropy under the hood with a queries x candidates embeddings matrix multiplication to get the scores. All of these are compared with an identity matrix which acts as the y_true variable in the loss function.

Let's assume, as a very simple example, that we have 2 users and 2 products, and that the batch size is 2. Let's now assume our dataset looks like :

User Product
A 1
B 2
A 2
B 1

For the first batch, the network will work to get the dot product of the embeddings of A and 1 close to 1, and the dot product of A and 2 close to 0 (cf identity matrix).
For the second batch, the network will work to get the dot product of the embeddings of A and 2 close to 1, and the embeddings of A and 1 close to 0, which is the exact opposite of what the network was told at batch 1.

My question is therefore : how can we avoid "erasing" or "contradicting" interactions for users who come back in different batches ?

Thanks a lot for your help !

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.