THUDM / ComiRec

Source code and dataset for KDD 2020 paper "Controllable Multi-Interest Framework for Recommendation"

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

关于MIND的sampled softmax layer

CaiAnyu opened this issue · comments

你好,请问一个MIND的问题。
最后的sampled softmax层负责抽取样本集,和attention层输出的user_eb计算softmax。但此时attention层的query是正样本item_eb,所以输出的这个user_eb也是和正样本item_eb相关的用户兴趣。那是不是就变成了用正样本得出的用户嵌入和负样本算softmax了?
而正确的softmax应该是attention层的query为负样本的情况下得到的用户嵌入(和负样本相关的用户兴趣),和这个负样本的嵌入来计算得到用户点击这个负样本的可能性吧。

Hello, I want to ask a question about your implementation of MIND.
The sample softmax layer uniformly selects samples to create the test set and calculates the softmax with the user embedding from the attention layer. When calculating the possibility of the user clicking the negative sample, the correct user embedding should be obtained when the query of the attention layer is the negative sample. However, the query in the attention layer is a positive sample, so the output user embedding is the user interests related to the positive sample. Do softmax with this user embedding and negative sample will lead to a low score for negative items and high accuracy.
Does this happen to your implementation, or I've got it wrong?

Hi @CaiAnyu,

感谢您对我们工作的关注!感觉您对sampled softmax的做法理解的有些偏差。在sampled softmax的做法里,可以认为训练中只有正样本对。这一点与negative sampling的做法有所不同。

sampled softmax是有负样本的。
https://github.com/tensorflow/tensorflow/blob/v2.4.1/tensorflow/python/ops/nn_impl.py#L1966-L1974
输出的logit和label是正负样本两部分concat起来的。

你认为这个是负样本也行。不过你看MIND论文里的公式(10)就明明白白写着使用正样本得到的用户表示去跟正负样本去做softmax。sampled softmax只是把分母中对所有商品的求和变为对部分采样出来的商品的求和。

嗯论文里确实是这么写的。
我看了下大佬的代码,所以测试是用Serving里的Faiss找最近邻,而不是再去用attention层输出的用户嵌入来测试了吗?
所以训练阶段的attention层只是为了帮助更好的训练Capsule Network?

是的。可以这么认为。