首页 > 其他分享 >Self-Attentive Sequential Recommendation

Self-Attentive Sequential Recommendation

时间:2023-02-24 11:25:39浏览次数:50  
标签:Self seqs Sequential criterion indices Attentive self

目录

Kang W. and McAuley J. Self-attentive sequential recommendation. In IEEE International Conference on Data Mining (ICDM), 2018.

Transformer 最初用在序列推荐之上.

主要方法

从我的角度来看, 这篇文章所用的结构和 GPT 的传播方式 几无二致, 唯一不同的好像就是采用了一个可训练的 position embeddings.

我这里只讲一下在代码里看到的一些奇奇怪怪的地方吧:


seqs = self.Item.look_up(seqs) # (B, S) -> (B, S, D)
seqs *= self.Item.dimension ** 0.5

即得到 embeddings 之后, 有个类似标准化的操作. 我个人测试下来, 这一步没有特别大的影响.

indices = positives != 0
loss = self.criterion(posLogits[indices], posLabels[indices]) + self.criterion(negLogits[indices], negLabels[indices])

因为, 我们会对那些不够长的序列进行 (left) padding 的操作, 所以, 训练的时候 0 的目标是 0, 上述的做法则是完全撇去了对 padding 的预测, 当然直观上是没问题的. 不过测试下来, 发现即使是使用:

loss = self.criterion(posLogits, posLabels) + self.criterion(negLogits, negLabels)

也没有特别大的影响.

代码

SASRec

SASRec.pytorch

标签:Self,seqs,Sequential,criterion,indices,Attentive,self
From: https://www.cnblogs.com/MTandHJ/p/17150621.html

相关文章