Abstract
為了更好的推薦,不僅要對user-item交互進行建模,還要將關系信息考慮進來
傳統(tǒng)方法因子分解機將每個交互都當作一個獨立的實例,但是忽略了item之間的關系(eg:一部電影的導演也是另一部電影的演員)
高階關系:用一個/多個鏈接屬性連接兩個item
KG+user-item graph+high order relations—>KGAT
遞歸傳播鄰域節(jié)點(可能是users、items、attributes)的嵌入來更新自身節(jié)點的嵌入,并使用注意力機制來區(qū)分鄰域節(jié)點的重要性
Introduction
u 1 u_1 u1?是要向其提供推薦的目標用戶。黃色圓圈和灰色圓圈表示通過高階關系發(fā)現(xiàn)但被傳統(tǒng)方法忽略的重要用戶和項目。
例如,用戶
u
1
u_1
u1?看了 電影
i
1
i_1
i1?,CF方法側重于同樣觀看了
i
1
i_1
i1?的相似用戶的歷史,即
u
4
u_4
u4?和
u
5
u_5
u5?,而監(jiān)督學習側重于與
i
1
i_1
i1?有相同屬性
e
1
e_1
e1?的電影
i
2
i_2
i2?,顯然,這兩種信息對于推薦是互補的,但是現(xiàn)有的監(jiān)督學習未能將這兩者統(tǒng)一起來,比如說這里
i
1
i_1
i1?和
i
2
i_2
i2?的
r
2
r_2
r2?屬性都是
e
1
e_1
e1?,但是它無法通過
r
3
r_3
r3?到達
i
3
i_3
i3?,
i
4
i_4
i4?,因為它把它們當成了獨立的部分,無法考慮到數據中的高階關系,比如黃色圈中的用戶看了同一個導演
e
1
e_1
e1?的其他電影
i
2
i_2
i2?,或者灰色圈中的電影也與
e
1
e_1
e1?有其他的關系。這些也是作出推薦的重要信息。
u
1
?
r
1
i
1
?
?
r
2
e
1
?
r
2
i
2
?
?
r
1
{
u
2
,
u
3
}
,
u
1
?
r
1
i
1
?
?
r
2
e
1
?
r
3
{
i
3
,
i
4
}
,
\begin{array}{l} u_{1} \stackrel{r_{1}}{\longrightarrow} i_{1} \stackrel{-r_{2}}{\longrightarrow} e_{1} \stackrel{r_{2}}{\longrightarrow} i_{2} \stackrel{-r_{1}}{\longrightarrow}\left\{u_{2}, u_{3}\right\}, \\ u_{1} \stackrel{r_{1}}{\longrightarrow} i_{1} \stackrel{-r_{2}}{\longrightarrow} e_{1} \stackrel{r_{3}}{\longrightarrow}\left\{i_{3}, i_{4}\right\}, \end{array}
u1??r1??i1???r2??e1??r2??i2???r1??{u2?,u3?},u1??r1??i1???r2??e1??r3??{i3?,i4?},?
存在問題
利用這種高階信息是存在挑戰(zhàn)的:
1) 與目標用戶具有高階關系的節(jié)點隨著階數的增加而急劇增加,這給模型帶來了計算壓力
2) 高階關系對預測的貢獻不均衡。
為此,論文提出了 Knowledge Graph Attention Network (KGAT) 的模型,它基于節(jié)點鄰居的嵌入來更新節(jié)點的嵌入,并遞歸地執(zhí)行這種嵌入傳播,以線性時間復雜度捕獲高階連接。另外采用注意力機制來學習傳播期間每個鄰居的權重。
GNN->KGAT
1、遞歸嵌入傳播,用領域節(jié)點嵌入來更新當前節(jié)點嵌入
2、使用注意力機制,來學習傳播期間每個鄰居的權重
優(yōu)點:
1、與基于路徑的方法相比,避免了人工標定路徑
2、與基于規(guī)則的方法相比,將高階關系直接融入預測模型
3. 模型框架
3.1 問題定義
Input:協(xié)同知識圖 G \mathcal G G, G \mathcal G G由user-item交互數據 G 1 \mathcal G_1 G1?和知識圖 G 2 \mathcal G_2 G2?組成
Output:user u u u點擊 item i i i的概率 y ^ u i \hat y_{ui} y^?ui?
高階連接:利用高階連接對于執(zhí)行高質量的推薦是至關重要的。我們將
L
L
L階連接 (
L
L
L- order connectivtiy) 定義為一個多跳關系路徑:
e
0
?
r
1
e
1
?
r
2
?
.
.
.
?
?
r
L
e
L
e_0 \stackrel {r_1}{\longrightarrow} e_1 \stackrel {r_2}{\longrightarrow} \ ... \ \stackrel {r_L}{\longrightarrow} e_L\\
e0??r1??e1??r2???...??rL??eL?
3.2 Embedding Layer
論文在知識圖嵌入方面使用了TransR模型,它的主要思想是不同的實體在不同的關系下有著不同的含義,所以需要將實體投影到特定關系空間中,假如
h
h
h和
t
t
t具有
r
r
r關系,那么它們在
r
r
r關系空間的表示應該接近,否則應該遠離,用公式表達則是:
e
h
r
+
e
r
≈
e
t
r
\mathbf e_h^r + \mathbf e_r \approx \mathbf e_t^r \\
ehr?+er?≈etr?
這里
e
h
,
e
t
∈
R
d
\mathbf e_h, \mathbf e_t \in \mathbb R^d
eh?,et?∈Rd,
e
r
∈
R
k
\mathbf e_r \in \mathbb R^k
er?∈Rk是
h
,
t
,
r
h ,t ,r
h,t,r的embedding。
它的得分為:
g
(
h
,
r
,
t
)
=
∣
∣
W
r
e
h
+
e
r
?
W
r
e
t
∣
∣
2
2
g(h,r,t)=||\mathbf W_r\mathbf e_h+\mathbf e_r-\mathbf W_r\mathbf e_t||_2^2\\
g(h,r,t)=∣∣Wr?eh?+er??Wr?et?∣∣22?
其中
W
r
∈
R
k
×
d
\mathbf W_r \in \mathbb R^{k\times d}
Wr?∈Rk×d是關系
r
r
r的轉換矩陣,將實體從
d
d
d維實體空間投影到
k
k
k維關系空間中。
g
(
h
,
r
,
t
)
g(h,r,t)
g(h,r,t)的值越低,說明該三元組為真的概率越大。
最后,用pairwise ranking loss來衡量效果:
L
K
G
=
∑
(
h
,
r
,
t
,
t
′
)
∈
τ
?
l
n
?
σ
(
g
(
h
,
r
,
t
′
)
?
g
(
h
,
r
,
t
)
)
\mathcal L_{KG} = \sum_{(h,r,t,t^{'})\in \tau} -ln \ \sigma(g(h,r,t^{'})-g(h,r,t))\\
LKG?=(h,r,t,t′)∈τ∑??ln?σ(g(h,r,t′)?g(h,r,t))
此式子的意思就是讓負樣本的值減去正樣本的值盡可能的大。負樣本的選擇就是將
t
t
t隨機替換成一個別的。
3.3 Attentive Embedding Propagation Layers
信息傳播
考慮實體
h
h
h,我們使用
N
h
=
{
(
h
,
r
,
t
)
∣
(
h
,
r
,
t
)
∈
G
}
\mathcal N_h = \{ (h,r,t)|(h,r,t) \in \mathcal G\}
Nh?={(h,r,t)∣(h,r,t)∈G}表示那些以
h
h
h為頭實體的三元組。計算
h
h
h的ego-network:
e
N
h
=
∑
(
h
,
r
,
t
)
∈
N
h
π
(
h
,
r
,
t
)
e
t
\mathbf e_{\mathcal N_h} = \sum _ {(h,r,t) \in \mathcal N_h} \pi(h,r,t) \mathbf e_t\\
eNh??=(h,r,t)∈Nh?∑?π(h,r,t)et?
π
(
h
,
r
,
t
)
\pi(h,r,t)
π(h,r,t)表示在關系
r
r
r下從
t
t
t傳到
h
h
h的信息量。
知識感知注意力
信息傳播中的權重
π
(
h
,
r
,
t
)
\pi(h,r,t)
π(h,r,t)是通過注意力機制實現(xiàn)的
π
(
h
,
r
,
t
)
=
(
W
r
e
t
)
T
t
a
n
h
(
W
r
e
h
+
e
r
)
\pi(h,r,t) = (\mathbf W_r \mathbf e_t)^Ttanh(\mathbf W_r \mathbf e_h+\mathbf e_r)\\
π(h,r,t)=(Wr?et?)Ttanh(Wr?eh?+er?)
這里使用
t
a
n
h
tanh
tanh作為激活函數可以使得在關系空間中越接近的
e
h
\mathbf e_h
eh?和
e
t
\mathbf e_t
et?有更高的注意力分值。采用
s
o
f
t
m
a
x
softmax
softmax歸一化:
π
(
h
,
r
,
t
)
=
e
x
p
(
π
(
h
,
r
,
t
)
)
∑
(
h
,
r
′
,
t
′
)
∈
N
h
e
x
p
(
π
(
h
,
r
′
,
t
′
)
)
\pi(h,r,t)=\frac{exp(\pi(h,r,t))}{\sum_{(h,r^{'},t^{'}) \in \mathcal N_h} exp(\pi(h,r^{'},t^{'}))}\\
π(h,r,t)=∑(h,r′,t′)∈Nh??exp(π(h,r′,t′))exp(π(h,r,t))?
最終憑借
π
(
h
,
r
,
t
)
\pi(h,r,t)
π(h,r,t)我們可以知道哪些鄰居節(jié)點應該被給予更多的關注。
信息聚合
最終將
h
h
h在實體空間中的表示
e
h
\mathbf e_h
eh?和其ego-network的表示
e
N
h
\mathbf e_{\mathcal N_h}
eNh??聚合起來作為
h
h
h的新表示:
e
h
(
1
)
=
f
(
e
h
,
e
N
h
)
\mathbf e_h^{(1)} = f(\mathbf e_h,\mathbf e_{\mathcal N_h})\\
eh(1)?=f(eh?,eNh??)
f
(
?
)
f(·)
f(?)有以下幾種方式:
- GCN Aggregator:
f G C N = L e a k y R e L U ( W ( e h + e N h ) ) f_{GCN}=LeakyReLU(\mathbf W(\mathbf e_h+\mathbf e_{\mathcal N_h})) fGCN?=LeakyReLU(W(eh?+eNh??)) - GraphSage Aggregator:
f G r a p h S a g e = L e a k y R e L U ( W ( e h ∣ ∣ e N h ) ) f_{GraphSage} = LeakyReLU( \mathbf W(\mathbf e_h || \mathbf e_{\mathcal N_h})) fGraphSage?=LeakyReLU(W(eh?∣∣eNh??)) - Bi-Interaction Aggregator:
f B i ? I n t e r a c t i o n = L e a k y R e L U ( W 1 ( e h + e N h ) ) + L e a k y R e L U ( W 2 ( e h ⊙ e N h ) ) f_{Bi-Interaction} = LeakyReLU(\mathbf W_1(\mathbf e_h+\mathbf e_{\mathcal N_h}))+LeakyReLU(\mathbf W_2(\mathbf e_h\odot\mathbf e_{\mathcal N_h})) fBi?Interaction?=LeakyReLU(W1?(eh?+eNh??))+LeakyReLU(W2?(eh?⊙eNh??))
高階傳播:
我們可以進一步堆疊更多的傳播層來探索高階連通信息,收集從更高跳鄰居傳播過來的信息,所以在
l
l
l步中:
e
h
(
l
)
=
f
(
e
h
(
l
?
1
)
,
e
N
h
(
l
?
1
)
)
\mathbf e_h^{(l)} = f( \mathbf e_h^{(l-1)},\mathbf e_{\mathcal N_h}^{(l-1)})\\
eh(l)?=f(eh(l?1)?,eNh?(l?1)?)
其中
e
N
h
(
l
?
1
)
=
∑
(
h
,
r
,
t
)
∈
N
h
π
(
h
,
r
,
t
)
e
t
(
l
?
1
)
\mathbf e_{\mathcal N_h}^{(l-1)} = \sum_{(h,r,t) \in \mathcal N_h} \pi(h,r,t)\mathbf e_t^{(l-1)}
eNh?(l?1)?=∑(h,r,t)∈Nh??π(h,r,t)et(l?1)?,而
e
t
(
l
?
1
)
\mathbf e_t^{(l-1)}
et(l?1)?也是通過上面的步驟從
e
t
0
\mathbf e_t^0
et0?得到的。
3.4 Prediction layer
在執(zhí)行 L L L層后,最終我們會得到用戶 u u u的多層表示: { e u ( 1 ) , . . . , e u ( L ) } \{\mathbf e_u^{(1)},...,\mathbf e_u^{(L)} \} {eu(1)?,...,eu(L)?},以及item i i i的多層表示: { e i ( 1 ) , . . , e i ( L ) } \{\mathbf e_i^{(1)},..,\mathbf e_i^{(L)} \} {ei(1)?,..,ei(L)?}
將其連接起來,即:
e
u
?
=
e
u
(
0
)
∣
∣
.
.
.
∣
∣
e
u
(
L
)
?
,
?
e
i
?
=
e
i
(
0
)
∣
∣
.
.
.
∣
∣
e
i
(
L
)
\mathbf e_u^{*} = \mathbf e_u^{(0)} || ...||\mathbf e_u^{(L)} \ ,\ \mathbf e_i^{*} = \mathbf e_i^{(0)} || ...||\mathbf e_i^{(L)} \\
eu??=eu(0)?∣∣...∣∣eu(L)??,?ei??=ei(0)?∣∣...∣∣ei(L)?
最后通過內積計算相關分數:
y
^
(
u
,
i
)
=
e
u
?
T
e
i
?
\hat y(u,i) = {\mathbf e_u^*}^T \mathbf e_i^*\\
y^?(u,i)=eu??Tei??
3.5 損失函數
損失函數使用了BPR loss:
L
C
F
=
∑
(
u
,
i
,
j
)
∈
O
?
l
n
?
σ
(
y
^
(
u
,
i
)
?
y
^
(
u
,
j
)
)
\mathcal L_{CF}=\sum_{(u,i,j) \in O} - ln \ \sigma(\hat y(u,i)-\hat y(u,j))\\
LCF?=(u,i,j)∈O∑??ln?σ(y^?(u,i)?y^?(u,j))
其中
O
=
{
(
u
,
i
,
j
)
∣
(
u
,
i
)
∈
R
+
,
(
u
,
j
)
∈
R
?
}
O = \{(u,i,j)|(u,i) \in \mathcal R^+, (u,j) \in \mathcal R^- \}
O={(u,i,j)∣(u,i)∈R+,(u,j)∈R?},
R
+
\mathcal R^+
R+表示正樣本,
R
?
\mathcal R^-
R?表示負樣本。文章來源:http://www.zghlxwxcb.cn/news/detail-599803.html
最終:
L
K
G
A
T
=
L
K
G
+
L
C
F
+
λ
∣
∣
Θ
∣
∣
2
2
\mathcal L_{KGAT} = \mathcal L_{KG} + \mathcal L_{CF} + \lambda||\Theta||_2^2\\
LKGAT?=LKG?+LCF?+λ∣∣Θ∣∣22?文章來源地址http://www.zghlxwxcb.cn/news/detail-599803.html
到了這里,關于【論文筆記】KDD2019 | KGAT: Knowledge Graph Attention Network for Recommendation的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網!