论文《TAGNN: Target Atentive Graph Neural Networks for Session-based Recommendation》阅读
论文概况
本文是2020年SIGIR上的一篇论文,作者于2019年提出SRGNN,而这篇文章也是在SRGNN上做了稍许改进,提出了TAGNN(Target Atentive Graph Neural Networks)模型。
Introduction
作者提出了几个问题
- 再次批评RNN,和SRGNN中说的一样
- 现有方法只将会话表示成固定向量却没有注意用户对目标物品的喜好程度
对于上述问题,作者提出了TAGNN模型:(1)将离散的会话序列转化为图结构信息来捕获完整的物品转化模式。(2)使用最后一个物品的向量作为用户的兴趣进行会话嵌入(3)用目标物品作为查询向量,生成目标embeding
Method
A.Constructing Session Graphs
一个会话构建一个会话图,会话图中边的权重直接取决于该点所连接的点的数量,一个点的所有边权重和为1。根据会话图可以得到出度矩阵和入度矩阵。
B.Learning Item Embeddings on Session Graphs
下面根据会话图进行物品向量计算,TAGNN认为一个结点的向量与邻接节点向量和自己本身向量有关。首先根据各个节点的向量与节点之间的邻接关系进行聚合。
a
s
,
i
t
=
A
s
,
i
:
[
v
1
t
−
1
,
…
,
v
n
t
−
1
]
⊤
H
+
b
(1)
\mathbf{a}_{s, i}^{t}=\mathbf{A}_{s, i:}\left[\mathbf{v}_{1}^{t-1}, \ldots, \mathbf{v}_{n}^{t-1}\right]^{\top} \mathbf{H}+\mathbf{b}\tag{1}
as,it=As,i:[v1t−1,…,vnt−1]⊤H+b(1)
之后计算重置门和更新门,利用循环门控单元来更新节点向量。
z
s
,
i
t
=
σ
(
W
z
a
s
,
i
t
+
U
z
v
i
t
−
1
)
(2)
\mathbf{z}_{s, i}^{t}=\sigma\left(\mathbf{W}_{z} \mathbf{a}_{s, i}^{t}+\mathbf{U}_{z} \mathbf{v}_{i}^{t-1}\right)\tag{2}
zs,it=σ(Wzas,it+Uzvit−1)(2)
r
s
,
i
t
=
σ
(
W
r
a
s
,
i
t
+
U
r
v
i
t
−
1
)
(3)
\mathbf{r}_{s, i}^{t}=\sigma\left(\mathbf{W}_{r} \mathbf{a}_{s, i}^{t}+\mathbf{U}_{r} \mathbf{v}_{i}^{t-1}\right)\tag{3}
rs,it=σ(Wras,it+Urvit−1)(3)
v
i
t
~
=
tanh
(
W
o
a
s
,
i
t
+
U
o
(
r
s
,
i
t
⊙
v
i
t
−
1
)
)
(4)
\widetilde{\mathbf{v}_{i}^{t}}=\tanh \left(\mathbf{W}_{o} \mathbf{a}_{s, i}^{t}+\mathbf{U}_{o}\left(\mathbf{r}_{s, i}^{t} \odot \mathbf{v}_{i}^{t-1}\right)\right)\tag{4}
vit
=tanh(Woas,it+Uo(rs,it⊙vit−1))(4)
v
i
t
=
(
1
−
z
s
,
i
t
)
⊙
v
i
t
−
1
+
z
s
,
i
t
⊙
v
~
i
t
(5)
\mathbf{v}_{i}^{t}=\left(1-\mathbf{z}_{s, i}^{t}\right) \odot \mathbf{v}_{i}^{t-1}+\mathbf{z}_{s, i}^{t} \odot \widetilde{\mathbf{v}}_{i}^{t}\tag{5}
vit=(1−zs,it)⊙vit−1+zs,it⊙v
it(5)
C.Constructing Target-Aware Embedding
这里是TAGNN相对于SRGNN的创新点,将目标物品作为查询向量,使用注意力机制来计算目标物品与用户兴趣的相关度
β
i
,
t
=
softmax
(
e
i
,
t
)
=
exp
(
v
t
⊤
W
v
i
)
∑
j
=
1
m
exp
(
v
t
⊤
W
v
j
)
(6)
\beta_{i, t}=\operatorname{softmax}\left(e_{i, t}\right)=\frac{\exp \left(\boldsymbol{v}_{t}^{\top} W \boldsymbol{v}_{i}\right)}{\sum_{j=1}^{m} \exp \left(\boldsymbol{v}_{t}^{\top} W \boldsymbol{v}_{j}\right)\tag{6}}
βi,t=softmax(ei,t)=∑j=1mexp(vt⊤Wvj)exp(vt⊤Wvi)(6)
s
target
t
=
∑
i
=
1
s
n
β
i
,
t
v
i
(7)
s_{\text {target }}^{t}=\sum_{i=1}^{s_{n}} \beta_{i, t} \boldsymbol{v}_{i}\tag{7}
starget t=i=1∑snβi,tvi(7)
D.Generating Session Embeddings
利用注意力机制将最后一个物品当作用户当前兴趣,生成整个会话的会话嵌入。
α
i
=
q
⊤
σ
(
W
1
v
n
+
W
2
v
i
+
c
)
(8)
\alpha_{i}=\mathbf{q}^{\top} \sigma\left(\mathbf{W}_{1} \mathbf{v}_{n}+\mathbf{W}_{2} \mathbf{v}_{i}+\mathbf{c}\right)\tag{8}
αi=q⊤σ(W1vn+W2vi+c)(8)
s
g
=
∑
i
=
1
n
α
i
v
i
(9)
\mathbf{s}_{\mathrm{g}}=\sum_{i=1}^{n} \alpha_{i} \mathbf{v}_{i}\tag{9}
sg=i=1∑nαivi(9)
将得到的目标嵌入与长期兴趣与当前兴趣拼接再降维。
s
t
=
W
3
[
s
target
t
;
s
local
;
s
global
]
(10)
s_{t}=W_{3}\left[s_{\text {target }}^{t} ; s_{\text {local }} ; s_{\text {global }}\right]\tag{10}
st=W3[starget t;slocal ;sglobal ](10)
E.Making Recommendation and Model Training
将得到的会话嵌入与相应的物品向量做乘积,再通过softmax得到推荐结果
z
t
^
=
s
t
⊤
v
t
(11)
\hat{z_{t}}=s_{t}^{\top} \boldsymbol{v}_{t}\tag{11}
zt^=st⊤vt(11)
y
^
=
softmax
(
z
^
)
(12)
\hat{\mathbf{y}}=\operatorname{softmax}(\hat{\mathbf{z}})\tag{12}
y^=softmax(z^)(12)
使用交叉熵定义损失函数
y
^
=
softmax
(
z
^
)
L
(
y
^
)
=
−
∑
i
=
1
m
y
i
log
(
y
^
i
)
+
(
1
−
y
i
)
log
(
1
−
y
^
i
)
(13)
\hat{\mathbf{y}}=\operatorname{softmax}(\hat{\mathbf{z}})\mathcal{L}(\hat{\mathbf{y}})=-\sum_{i=1}^{m} \mathbf{y}_{i} \log \left(\hat{\mathbf{y}}_{i}\right)+\left(1-\mathbf{y}_{i}\right) \log \left(1-\hat{\mathbf{y}}_{i}\right)\tag{13}
y^=softmax(z^)L(y^)=−i=1∑myilog(y^i)+(1−yi)log(1−y^i)(13)
总结
TAGNN在SRGNN基础上做了少许改动,考虑了目标物品的影响。但在物品较多的数据中,目标嵌入的计算量很大,每一个物品都要与会话中的项目进行注意力计算。且该模型还是在SRGNN的一个扩展,我认为可借鉴意义不大。