tensorflow / tensorflow/recommenders
Question on "in batch softmax" and retrieval task
@maciejkula is already working on this.
Since Apr 27, 2021.
- 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
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.
Assessment
This issue has not been assessed yet.