论文名称:SEMI-SUPERVISED CLASSIFICATION WITH GRAPH CONVOLUTIONAL NETWORKS
1 论文简介
图半监督分类问题:只有一小部分或者节点的子集存在标签,比如通过引用构建构建的文献分类,这种问题我们可以定义为基于图的半监督学习。
传统做法基本为图的正则化处理,比如 Laplacian regularization ,损失函数形式如下:
。
Eq 1 假设图中具有连接边的节点标签是一样的,这种假设一定程度上限制了模型。
2 FAST APPROXIMATE CONVOLUTIONS ON GRAPHS
reference:zhangxwww.github.io/pos
本文提出了layer-wise propagation (也就是layer by layer training)的GCN:
其中,:
(1) 是一个可训练的参数矩阵;
(2) ;
(3) ;
图上的spectral convolutions 被定义为输入 傅里叶变换的乘积:
其中 。由于计算矩阵特征分解复杂度非常高,作者借助切比雪夫多项式进行近似:
,
其中 ,为切比雪夫多项式的系数。
切比雪夫多项式定义为:
考虑到 ,有:
,
其中 ,
这就是原式的K阶近似,只考虑到了每个结点的K阶邻点。本文令 。
同时,作者将 ,这个近似是因为作者认为网络可以通过学到的scale适应这个变化。这样就得到了下面的式子:
更进一步令 ,有:
注意到 内,对于深度网络来说可能会发生梯度消失/爆炸的情况。作者介绍了一个trick,来避免这种情况的发生:
其中
因此通过下式就可以将C个通道的输入 转化为F维的输出:
其中
3 SEMI-SUPERVISED NODE CLASSIFICATION
模型定义为以下形式:
计算所有带有标签的样本的交叉熵:
4 实验结果
数据集:
实验结果:
我们可以看到GCN比传统的节点分类算法(例如DeepWalk)效果高出了好多。
Pytorch实现:github.com/tkipf/pygcn
Tensorflow实现:github.com/tkipf/gcn
5 代码实现
GCN 层的实现:
**import** math **import** torch **from** torch.nn.parameter **import** Parameter **from** torch.nn.modules.module **import** Module **class** **GraphConvolution** (Module):
""" Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """
**def** __init__(self, in_features, out_features, bias **=** True):
super(GraphConvolution, self) **.** __init__()
self **.** in_features **=** in_features
self **.** out_features **=** out_features
self **.** weight **=** Parameter(torch **.** FloatTensor(in_features, out_features))
**if** bias:
self **.** bias **=** Parameter(torch **.** FloatTensor(out_features))
**else** :
self **.** register_parameter('bias', None)
self **.** reset_parameters()
**def** **reset\_parameters** (self):
stdv **=** 1. **/** math **.** sqrt(self **.** weight **.** size(1))
self **.** weight **.** data **.** uniform_( **-** stdv, stdv)
**if** self **.** bias **is** **not** None:
self **.** bias **.** data **.** uniform_( **-** stdv, stdv)
**def** **forward** (self, input, adj):
support **=** torch **.** mm(input, self **.** weight)
output **=** torch **.** spmm(adj, support)
**if** self **.** bias **is** **not** None:
**return** output **+** self **.** bias
**else** :
**return** output
**def** __repr__(self):
**return** self **.** __class__ **.** __name__ **+** ' (' \ **+** str(self **.** in_features) **+** ' -> ' \ **+** str(self **.** out_features) **+** ')'
两层GCN模型的实现
import torch.nn as nn
import torch.nn.functional as F
from pygcn.layers import GraphConvolution
class GCN(nn.Module):
def __init__(self, nfeat, nhid, nclass, dropout):
super(GCN, self).__init__()
self.gc1 = GraphConvolution(nfeat, nhid)
self.gc2 = GraphConvolution(nhid, nclass)
self.dropout = dropout
def forward(self, x, adj):
x = F.relu(self.gc1(x, adj))
x = F.dropout(x, self.dropout, training=self.training)
x = self.gc2(x, adj)
return F.log_softmax(x, dim=1)
完成训练代码以及数据集下载可以参考Pytorch实现:github.com/tkipf/pygcn
6 参考文献
提示:点击“阅读原文”获取所有连接内容
-
论文笔记 | Semi-Supervised Classification With Graph Convolutional Networks
-
论文笔记之:Semi-supervised Classification with Graph Convolutional Networks
-
【GCN】论文笔记:SEMI-SUPERVISED CLASSIFICATION WITH GRAPH CONVOLUTIONAL NETWORKS
-
机器学习论文笔记-Semi-Supervised Classification with Graph Convolutional Networks
-
GRAPH CONVOLUTIONAL NETWORKS
-
【Graph Neural Network】GCN: 算法原理,实现和应用
-
Tutorial: Implementing Layer-Wise Relevance Propagation
大家加左图进入微信群;右图有QQ学习交流群
发现“在看”和“赞”了吗,戳我试试吧