ICLR2018 GNN GAT论文解读

Graph Attentional Networks

论文链接:https://arxiv.org/pdf/1710.10903v3.pdf

论文代码:pytorch geomtetric有实现

摘要

Abstract: We present graph attention networks (GATs), novel neural network architectures that operate on graph-structured data, leveraging masked self-attentional layers to address the shortcomings of prior methods based on graph convolutions or their approximations. By stacking layers in which nodes are able to attend over their neighborhoods’ features, we enable (implicitly) specifying different weights to different nodes in a neighborhood, without requiring any kind of costly matrix operation (such as inversion) or depending on knowing the graph structure upfront. In this way, we address several key challenges of spectral based graph neural networks simultaneously, and make our model readily applicable to inductive as well as transductive problems. Our GAT models have achieved or matched state-of-theart results across four established transductive and inductive graph benchmarks: the Cora, Citeseer and Pubmed citation network datasets, as well as a proteinprotein interaction dataset (wherein test graphs remain unseen during training).

摘要:我们提出图注意力网络(GAT),对图结构数据进行操作的新型神经网络架构,利用自注意力机制来解决基于图卷积或其近似的先前方法的缺点。通过叠加节点能够参与其邻域特征的层,我们可以(隐式地)为邻域中的不同节点指定不同的权重,而不需要任何昂贵的矩阵运算(如求逆)或预先知道图形结构。通过这种方式,我们同时解决了基于谱的图神经网络的几个关键挑战,并使我们的模型易于适用于感应和传导问题。我们的GAT模型已经实现或匹配了四个已建立的转导和归纳图基准的最新结果:Cora、Citeser和Pubmed引文网络数据集,以及protein-protein interaction数据集(其中用于测试的图在训练期间不可见)。

1. 前言

受最近工作的启发,我们引入了一种基于注意力机制的体系结构来执行图结构数据的节点分类。其思想是通过关注其邻居,遵循自注意力策略,计算图中每个节点的隐藏表示。此注意力结构有几个特性:(1)操作是高效的,因为它可以跨节点-邻居对,做并行化处理;(2) 通过对邻域指定任意权重,可以将其应用于具有不同程度的图节点;(3)该模型直接适用于Inductive Learning问题,包括模型必须推广到完全看不见的图的任务。

2 图注意力层(Graph Attentional Layer)

从题目中的Graph Attentional Layer中可以感觉到,这个注意力机制,应该是像resiual block或者SENet一样,为一个小的模块,即插即用。
在这里插入图片描述

具体怎么实现呢,接着往下:

从单层图注意力机制定义出发,对这一层注意力图网络:

输入:节点特征, h = { h → 1 , h → 2 , . . . , h → N } , h → i ∈ R F h=\{\overrightarrow{h}_1 ,\overrightarrow{h}_2,...,\overrightarrow{h}_N \},\quad \overrightarrow{h}_i \in R^F h={ h 1,h 2,...,h N},h iRF N N N为节点数量, F F F为每个节点的特征数

输出:产生一组新的节点特征 h ′ = { h ′ → 1 , h ′ → 2 , . . . , h ′ → N } , h ′ → i ∈ R F h^{'}=\{\overrightarrow{h^{'}}_1 ,\overrightarrow{h^{'}}_2,...,\overrightarrow{h^{'}}_N \},\quad \overrightarrow{h^{'}}_i \in R^F h={ h 1,h 2,...,h N},h iRF为输出

为了获得足够的表达能力将输入特征转换为更高级别的特征,至少需要一个可学习的线性变换。为此,作为初始步骤,共享线性变换由权重矩阵 W ∈ R F ′ × F W\in R^{F^{'}\times F} WRF×F参数化,应用到每个节点。然后使用自注意力机制到每个节点,一种共享的注意力机制 a    :    R F ′ × R F ′ → R a\; : \; R^{F^{'}}\times R^{F^{'}} \rightarrow R a:RF×RFR,计算注意力系数。
e i j = a ( W h → i ,    W h → j ) e_{ij}=a(W\overrightarrow{h}_i,\;W\overrightarrow{h}_j) eij=a(Wh i,Wh j)
表征节点i和节点j之间的重要性。它的更通用表示,此模型允许每个节点参与其他节点,合并所有结构信息。但我们只使用每个节点的邻居节点信息,即 N i N_i Ni。其中 i i i为当前节点, j ∈ N i j\in N_i jNi i i i节点的邻居节点。

扫描二维码关注公众号,回复: 15136894 查看本文章

在我们的实验中, N i N_i Ni正是节点i(包括i)的一阶邻居。为了使系数在不同节点之间易于比较,我们使用softmax函数对 e i j e_{ij} eij归一化。
α i j = s o f t m a x j ( e i j ) = e x p ( e i j ) ∑ k ∈ N i e x p ( e i k ) \alpha_{ij}=softmax_j(e_{ij})=\cfrac{exp(e_{ij})}{\sum_{k\in N_i}exp(e_{ik})} αij=softmaxj(eij)=kNiexp(eik)exp(eij)
完整公式:
α i j = L e a k y R e L U ( a T → [ W h → i ∣ ∣    W h → j ] ) ∑ k ∈ N i L e a k y R e L U ( a T → [ W h → i ∣ ∣    W h → k ] ) \alpha_{ij}=\cfrac{LeakyReLU(\overrightarrow{a^T}[W\overrightarrow{h}_i||\;W\overrightarrow{h}_j])} {\sum_{k\in N_i}LeakyReLU(\overrightarrow{a^T}[W\overrightarrow{h}_i||\;W\overrightarrow{h}_k])} αij=kNiLeakyReLU(aT [Wh iWh k])LeakyReLU(aT [Wh iWh j])
其中 ∣ ∣ || 表示concat操作,其中 α \alpha α为单层全连接层网络,参数为 2 ⋅ F ′ 2 \cdot F^{'} 2F个,所以有
[ 1 , 2 F ′ ] ∗ [ 2 F ′ , 1 ] → s c a l a r [1, 2F^{'}] * [2F^{'}, 1]\rightarrow scalar [1,2F][2F,1]scalar
对于每个节点,上述方法是双向的,即两个节点对彼此的权重是一致的,为了保证中心节点收到的注意力是好的,可以对每个邻居节点多几个注意力机制。

猜你喜欢

转载自blog.csdn.net/weixin_43913124/article/details/124134789
GNN