Preliminaries
图神经网络
一个图 G \mathcal{G} G由其邻接矩阵和节点特征 ( A , X ) (\mathbf{A},\mathbf{X}) (A,X)表示,其中 A ∈ { 0 , 1 } n × n \mathbf{A} \in\{0,1\}^{n \times n} A∈{0,1}n×n, X = { x 1 , … , x n } ∈ R n × h \mathbf{X} = \left\{\mathrm{x}_{1}, \ldots, \mathrm{x}_{n}\right\} \in \mathbb{R}^{n \times h} X={x1,…,xn}∈Rn×h。图 G \mathcal{G} G的节点表示通过堆叠的GNN学习: Z = GNN ( A , X ) \mathrm{Z}=\operatorname{GNN}(\mathbf{A}, \mathbf{X}) Z=GNN(A,X)。
基于图的Few-shot Learning问题
同few-shot leanring方法常规设置一样,本文在概率分布
E
\mathcal{E}
E中采样得到图序列
{
G
1
,
…
,
G
N
t
}
\left\{\mathcal{G}_{1}, \ldots, \mathcal{G}_{N_{t}}\right\}
{G1,…,GNt}。对其中的每一张图,划分为support nodes set和query nodes set,分别表示为
S
i
=
{
(
x
i
,
j
s
i
,
y
i
,
j
s
i
)
}
j
=
1
n
s
i
\mathcal{S}_{i}=\left\{\left(\mathbf{x}_{i, j}^{s_{i}}, y_{i, j}^{s_{i}}\right)\right\}_{j=1}^{n^{s_{i}}}
Si={(xi,jsi,yi,jsi)}j=1nsi和
Q
i
=
{
(
x
i
,
j
q
i
,
y
i
,
j
q
i
)
}
j
=
1
n
q
i
\mathcal{Q}_{i}=\left\{\left(\mathbf{x}_{i, j}^{q_{i}}, y_{i, j}^{q_{i}}\right)\right\}_{j=1}^{n^{q_{i}}}
Qi={(xi,jqi,yi,jqi)}j=1nqi。其中
y
i
,
j
∈
{
1
,
…
K
}
y_{i, j} \in\{1, \ldots K\}
yi,j∈{1,…K}为节点对应的标签。query nodes set中节点标签的预测依赖于它的embedding与support nodes set中各类节点的prototype
c
i
k
c_i^k
cik的度量关系d。embedding通过graph autoencoder学习得到。对于每张图的query nodes set ,其通过
L
i
=
∑
k
L
i
k
\mathcal{L}_{i}=\sum_{k} \mathcal{L}_{i}^{k}
Li=∑kLik评估,其中:
L
i
k
=
−
∑
(
x
i
,
j
q
i
,
y
i
,
j
q
i
)
∈
Q
i
k
log
exp
(
−
d
(
f
θ
(
A
,
x
i
,
j
q
i
)
,
c
i
k
)
)
∑
k
′
exp
(
−
d
(
f
θ
(
A
,
x
i
,
j
q
i
)
,
c
i
k
′
)
)
\mathcal{L}_{i}^{k}=-\sum_{\left(\mathbf{x}_{i, j}^{q_{i}}, y_{i, j}^{q_{i}}\right) \in \mathcal{Q}_{i}^{k}} \log \frac{\exp \left(-d\left(f_{\theta}\left(\mathbf{A}, \mathbf{x}_{i, j}^{q_{i}}\right), \mathbf{c}_{i}^{k}\right)\right)}{\sum_{k^{\prime}} \exp \left(-d\left(f_{\theta}\left(\mathbf{A}, \mathbf{x}_{i, j}^{q_{i}}\right), \mathbf{c}_{i}^{k^{\prime}}\right)\right)}
Lik=−(xi,jqi,yi,jqi)∈Qik∑log∑k′exp(−d(fθ(A,xi,jqi),cik′))exp(−d(fθ(A,xi,jqi),cik))
直观来说,就是看看query nodes set和support nodes set中的哪类节点更相似,一次来作为目标函数优化embedding函数
f
θ
f_\theta
fθ。上角标
k
k
k表示类别。
graph few-shot learning的目的就是从这一系列图中学习一个性能很好的embedding function f θ f_\theta fθ,使其能够用于只有少量support set的新图。这里的不同的图,就对应于meta-learning中的不同任务,表示任务层面的泛化。
Methodology
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-cwW7stdh-1600737378085)(…/images/GFLKT1.png)]
首先我们看看方法的总框架图。
数据首先被送入©,即graph autoencoder,这个模块被称作Auxiliary Graph Reconstruction是因为作者在这里加了一个重构损失,我们后面说。© 的输出分别进入 (a) Graph Structured Prototype; (b) Hierarchical Graph Representation Gate。(a) 用来学习图中support nodes set的prototype c i k c_i^k cik。(b) 用来学习graph-specific的图层次化表达。
接下来我们分别看看这三个模块。
(a) Graph Structured Prototype
在大多数情况下,一个节点在图中有两个重要作用。一个是与类别可能不同的邻节点之间的关系,另一个是与远距离同类节点之间的关系。图 G \mathcal{G} G的embedding,也就是 Z = GNN ( A , X ) \mathrm{Z}=\operatorname{GNN}(\mathbf{A}, \mathbf{X}) Z=GNN(A,X),只考虑了第一个作用。又因为需要给图 G \mathcal{G} G的support nodes set学习一个global信息的prototype c i k c_i^k cik,也就是对应第二个作用,所以本部分提出了解决方法:Prototype GNN(PGNN)。
既然是基于GNN的解决方案,就要构建邻接矩阵。论文中对图 G \mathcal{G} G的support nodes set中每一类节点分别构建邻接矩阵 R i k \mathcal{R}_{i}^{k} Rik。该类节点的特征为经过graph autoencoder的 f θ ( S i k ) f_{\theta}\left(\mathcal{S}_{i}^{k}\right) fθ(Sik)。邻接矩阵的构建依赖于相似性度量方法,为了提高邻接矩阵的鲁棒性并减少离群点的干扰,对相似性低于某个阈值的两个点在邻接矩阵中赋予固定的值。
所以,graph structured prototype构建方式为:
c
i
k
=
Pool
j
=
1
n
s
i
k
(
P
G
N
N
ϕ
(
R
i
k
,
f
θ
(
S
i
k
)
)
[
j
]
)
\mathbf{c}_{i}^{k}=\operatorname{Pool}_{j=1}^{n^{s^{k}_i}}\left(\mathrm{PGNN}_{\phi}\left(\mathcal{R}_{i}^{k}, f_{\theta}\left(\mathcal{S}_{i}^{k}\right)\right)[j]\right)
cik=Poolj=1nsik(PGNNϕ(Rik,fθ(Sik))[j])
其中
j
j
j表示节点索引,
n
s
i
k
n^{s^{k}_i}
nsik表示support nodes set中
k
k
k类节点的数量。
P
o
o
l
Pool
Pool表示最大或平均池化。值得注意的是,这里的
P
G
N
N
PGNN
PGNN的参数是在不同类别的support nodes set间共享的。
(b) Hierarchical Graph Representation Gate
(a)中的 P G N N PGNN PGNN的构建只有一个全局共享的参数 ϕ \phi ϕ。但是不同的图有他们独有的拓扑结构,所以这启发作者没每个图定制全局共享信息。这个graph-specific定制的信息再进一步通过门控方法与PGNN的参数融合。
这部分的方法图如上,整体上借鉴了DiffPool的方法分两步进行:1. Node Assignment;2. Representation Fusion。
第一步Node Assignment计算类似DiffPool中的Soft Assignment Matrix (
S
S
S)。不同的是,DiffPool中的
S
S
S用于池化,所以池化前后的节点数量是变化(减少)的。但本文中该方法不是用来池化,而是阐述了图的不同层次的表征的概念。此时,Node Assignment后节点数量不变,变化的是节点的特征。本文中Node Assignment用
P
i
r
→
r
+
1
∈
R
K
r
×
K
r
+
1
\mathbf{P}_{i}^{r \rightarrow r+1} \in \mathbb{R}^{K^{r} \times K^{r+1}}
Pir→r+1∈RKr×Kr+1来表示,
r
r
r表示图所在的level,
K
K
K表示节点数量。把第
k
r
k^r
kr个节点映射到
r
+
1
l
e
v
e
l
r+1 \ level
r+1 level的计算方式为经过
s
o
f
t
m
a
x
softmax
softmax的
G
N
N
(
A
G
N
N
)
GNN(AGNN)
GNN(AGNN)层。具体如下:
p
i
k
r
→
k
r
+
1
=
exp
(
A
G
N
N
(
A
i
r
,
X
i
r
)
[
k
r
,
k
r
+
1
]
)
∑
k
r
+
1
=
1
K
r
+
1
exp
(
A
G
N
N
(
A
i
r
,
X
i
r
)
[
k
r
,
k
ˉ
r
+
1
]
)
p_{i}^{k^{r} \rightarrow k^{r+1}}=\frac{\exp \left(\mathrm{AGNN}\left(\mathbf{A}_{i}^{r}, \mathbf{X}_{i}^{r}\right)\left[k^{r}, k^{r+1}\right]\right)}{\sum_{k^{r+1}=1}^{K^{r+1}} \exp \left(\mathrm{AGNN}\left(\mathbf{A}_{i}^{r}, \mathbf{X}_{i}^{r}\right)\left[k^{r}, \bar{k}^{r+1}\right]\right)}
pikr→kr+1=∑kr+1=1Kr+1exp(AGNN(Air,Xir)[kr,kˉr+1])exp(AGNN(Air,Xir)[kr,kr+1])
第二步Representation Fusion仍类似与
D
i
f
f
P
o
o
l
DiffPool
DiffPool,即更新
(
A
,
X
)
(\mathbf{A},\mathbf{X})
(A,X)使图上升一个
l
e
v
e
l
level
level(
D
i
f
f
P
o
o
l
DiffPool
DiffPool中为更新池化后的图结构):
A
i
r
+
1
=
(
P
i
r
→
r
+
1
)
T
A
i
r
P
i
r
→
r
+
1
\mathbf{A}_{i}^{r+1}=\left(\mathbf{P}_{i}^{r \rightarrow r+1}\right)^{T} \mathbf{A}_{i}^{r} \mathbf{P}_{i}^{r \rightarrow r+1}
Air+1=(Pir→r+1)TAirPir→r+1
X i r + 1 = ( P i r → r + 1 ) T FGNN ( A i r , X i r ) \mathbf{X}_{i}^{r+1}=\left(\mathbf{P}_{i}^{r \rightarrow r+1}\right)^{T} \operatorname{FGNN}\left(\mathbf{A}_{i}^{r}, \mathbf{X}_{i}^{r}\right) Xir+1=(Pir→r+1)TFGNN(Air,Xir)
其中FGNN也是一个GNN层。进一步,每个 l e v e l level level的图特征 h i r h_i^r hir由 X i r \mathbf{X}_{i}^{r} Xir经过池化得到。
经过不断的提升图的
l
e
v
e
l
level
level,我们得到了一个不同层次的图特征表达集合
{
h
i
1
,
…
,
h
i
R
}
\left\{\mathbf{h}_{i}^{1}, \ldots, \mathbf{h}_{i}^{R}\right\}
{hi1,…,hiR}。为了进一步聚合集合,作者提出了两种聚合方式:mean pooling aggregator和attention aggregator(上图中所示)。这两种方式分别如下计算:
h
i
=
AGG
mean
(
{
h
i
1
,
…
,
h
i
R
}
)
=
1
R
∑
r
=
1
R
h
i
r
\mathbf{h}_{i}=\operatorname{AGG}_{\operatorname{mean}}\left(\left\{\mathbf{h}_{i}^{1}, \ldots, \mathbf{h}_{i}^{R}\right\}\right)=\frac{1}{R} \sum_{r=1}^{R} \mathbf{h}_{i}^{r}
hi=AGGmean({hi1,…,hiR})=R1r=1∑Rhir
h i = AGG a t t ( { h i 1 , … , h i R } ) = ∑ r = 1 R β i r h i r = ∑ r = 1 R q i T h i r ∑ r ′ = 1 R q i T h i r ′ h i r \mathbf{h}_{i}=\operatorname{AGG}_{\mathrm{att}}\left(\left\{\mathbf{h}_{i}^{1}, \ldots, \mathbf{h}_{i}^{R}\right\}\right)=\sum_{r=1}^{R} \beta_{i}^{r} \mathbf{h}_{i}^{r}=\sum_{r=1}^{R} \frac{\mathbf{q}_{i}^{T} \mathbf{h}_{i}^{r}}{\sum_{r^{\prime}=1}^{R} \mathbf{q}_{i}^{T} \mathbf{h}_{i}^{r^{\prime}}} \mathbf{h}_{i}^{r} hi=AGGatt({hi1,…,hiR})=r=1∑Rβirhir=r=1∑R∑r′=1RqiThir′qiThirhir
其中 q q q为attention aggregator引入的参数。再得到最终的 h i h_i hi后,作者认为其包含了graph-specific的信息。
再进一步,需要将该graph-specific的
h
i
h_i
hi融合到
P
G
N
N
PGNN
PGNN中的参数
ϕ
\phi
ϕ中。在理论层面,作者通过门控+点乘的方式去激活
ϕ
\phi
ϕ的不同维度,在实践层面,更像是为了使
h
i
h_i
hi和
ϕ
\phi
ϕ维度保持一致。具体体现在:
ϕ
i
=
g
i
∘
ϕ
=
T
(
h
i
)
∘
ϕ
\phi_{i}=\mathbf{g}_{i} \circ \phi=\mathcal{T}\left(\mathbf{h}_{i}\right) \circ \phi
ϕi=gi∘ϕ=T(hi)∘ϕ
g i = T ( h i ) = σ ( W g h i + b g ) , \mathbf{g}_{i}=\mathcal{T}\left(\mathbf{h}_{i}\right)=\sigma\left(\mathbf{W}_{g} \mathbf{h}_{i}+\mathbf{b}_{g}\right), gi=T(hi)=σ(Wghi+bg),
Auxiliary Graph Reconstruction
这一部分为graph autoencoder引入了重构损失(reconstruction loss):
L
r
(
A
i
,
X
i
)
=
∥
A
i
−
GNN
d
e
c
(
Z
i
)
GNN
dec
T
(
Z
i
)
∥
F
2
\mathcal{L}_{r}\left(\mathbf{A}_{i}, \mathbf{X}_{i}\right)=\left\|\mathbf{A}_{i}-\operatorname{GNN}_{d e c}\left(\mathbf{Z}_{i}\right) \operatorname{GNN}_{\operatorname{dec}}^{T}\left(\mathbf{Z}_{i}\right)\right\|_{F}^{2}
Lr(Ai,Xi)=
Ai−GNNdec(Zi)GNNdecT(Zi)
F2
其中
Z
i
=
GNN
enc
(
A
i
,
H
i
)
\mathbf{Z}_{i}=\operatorname{GNN}_{\text {enc}}\left(\mathbf{A}_{i}, \mathbf{H}_{i}\right)
Zi=GNNenc(Ai,Hi),
∥
⋅
∥
F
\|\cdot\|_{F}
∥⋅∥F为Frobenius norm。
引入该损失函数的意义在于,进一步提升训练的稳定性和节点表征的质量。
Workflow
通过算法流程来回顾上述方法,将他们串联成一个整体。
Experiments
实验目的有三:
- 证明所提方法***(GFL)***的有效性;
- 证明所提出的Graph Structured Prototype和Hierarchical Graph Representation Gate的有效性;
- 证明能够为每个类学习更好的特征表达。
数据集
使用了四个不同类型的图数据集:Collaboration, Reddit, Citation 和 Pubmed。数据集信息如下:
对比实验
实验对比了三个类型的方法:(1) 基于图的半监督方法 (2) 图表示学习方法 (3) 迁移/小样本学习方法。从下面的实验结果中可以证明该方法的有效性。
消融实验
作者分别拆分了论文所涉及的三个模块,进行了详细的拆解和消融实验,从表中可以看得很清晰,也进一步验证了结果。
敏感性分析
这部分实验讨论了四个问题:(1) Support Set大小; (2) 构建图邻接矩阵时的阈值; (3) 构建邻接矩阵时采用的不同相似度度量方法; (4) 第一个损失函数中的距离度量方法。
embedding效果对比
对比本文方法与Protonet的方法可见,本文方法对两类样本点划分的更加明确。
Conclusion
这篇论文基于三个创新的模块构建了半监督节点分类模型。在基于度量的few-shot learning基础上,融合了local和global两个level的信息。本文的亮点在于它对few-shot learning 和 GNN 方法结合过程中的每一个模块都进行了思考与创新,且消融实验做的非常充分。
于三个创新的模块构建了半监督节点分类模型。在基于度量的few-shot learning基础上,融合了local和global两个level的信息。本文的亮点在于它对few-shot learning 和 GNN 方法结合过程中的每一个模块都进行了思考与创新,且消融实验做的非常充分。