知行编程网知行编程网  2022-05-03 11:00 知行编程网 隐藏边栏 |   抢沙发  7 
文章评分 0 次,平均分 0.0

【GCN】图卷积网络 Graph Convolutional Networks

作者 | Frank Cao
专栏 | 深度学习
地址 | https://zhuanlan.zhihu.com/p/101005150
本文仅作学术分享,若侵权,请联系后台删文处理

   1. Basic

【GCN】图卷积网络 Graph Convolutional Networks

上面左图是2D卷积神经网络,其输入是4行4列的矩阵,通过卷积核逐步移动实现对整个输入的卷积操作;而右图输入是图网络,其结构和连接是不规则的,无法像卷积神经网络那样实现卷积操作,由此提出图卷积网络。
以Zachary’s Karate Club社群为例,其结构如下图所示:


【GCN】图卷积网络 Graph Convolutional Networks

即总共是0~33共34个node,代表34个人,两个node如果有线段连接代表两者关联,否则无关联;这34个人被分为两类,分别是“Officer”和“Mr. Hi”;为便于查看整个网络中每个人与其他人的关联关系,重构关联图如下:

【GCN】图卷积网络 Graph Convolutional Networks

基于上图结构,定义矩阵A(其shape=[34,34])如下, 每一行代表一个Node;

【GCN】图卷积网络 Graph Convolutional Networks

A[0] =[0., 1., 1., 1., 1., 1., 1., 1., 1., 0., 1., 1., 1., 1., 0., 0., 0., 1., 0., 1., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0.],代表第0个node与第1、2、3、4、5、6、7、8、10、11、12、13、17、19、21、31个node关联;
A[11] = [1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,0., 0.],代表第11个node只与第0个node关联;
A[12] = [1., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],代表第12个node只与第0、3个node关联;
定义矩阵X(其shape=[34, k],如k=3),每一行代表一个node的3个特征;其初始值随机生成;
定义矩阵W(其shape=[k, 1]),随机参数矩阵;
类别(Label):node[0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 16, 17, 19, 21]是“Mr. Hi”;node[9, 14, 15, 18, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33]是“Officer”;
图卷积网络的propagation如下:

【GCN】图卷积网络 Graph Convolutional Networks
【GCN】图卷积网络 Graph Convolutional Networks
图卷积网络可用于特征表征,即最小化Loss,更新矩阵X和W,其中矩阵X的每一行即为对应node的特征,这和word2vec模型很像。
模型地址:https://zhuanlan.zhihu.com/p/88757091


   2. More
矩阵A的每一行表示的关联点并不包含其自身,为更好的表达网络结构,定义矩阵AI
AI = A + eye(34);
矩阵AI中值为1.0多的行比少的行在propagation中意味着更大的值,训练时不稳定,容易造成梯度爆炸,由此引入对角矩阵D;

【GCN】图卷积网络 Graph Convolutional Networks

则图卷积网络的propagation修改为:
【GCN】图卷积网络 Graph Convolutional Networks
该式后又优化为:

【GCN】图卷积网络 Graph Convolutional Networks
Notes:D是对角矩阵,此处定义其0元素的负k(k=1.0, 0.5)次方仍是0;
优化前后两者的区别在于:

【GCN】图卷积网络 Graph Convolutional Networks
即优化后,运算时不仅仅考虑D矩阵中node[i]对应的点还考虑了node[j]对应的点;
Loss函数不变,仍为下式:
【GCN】图卷积网络 Graph Convolutional Networks

最小化Loss,更新X和W矩阵,其中X即为特征表征;

   3. Other
3.1 X矩阵:特征表征
3.1.1 Karate Club的三维表征(即X矩阵为三维矩阵,并将其通过pca进行维度转换及降维进行展示)
【GCN】图卷积网络 Graph Convolutional Networks
3.1.2 football的多维(1~5)表征
【GCN】图卷积网络 Graph Convolutional Networks
1D feature representation
【GCN】图卷积网络 Graph Convolutional Networks
2D feature representation
【GCN】图卷积网络 Graph Convolutional Networks
3D feature representation
【GCN】图卷积网络 Graph Convolutional Networks
4D feature representation
【GCN】图卷积网络 Graph Convolutional Networks
5D feature representation

【GCN】图卷积网络 Graph Convolutional Networks
train figure for loss and accuracy
3.2 Semi-Supervised(半监督)
上述讨论中是所有node都是已知的,即其在网络中的关联关系和类别(Label)都是已知的,则矩阵A的shape=[34,34];如果有N个node在网络中的关联关系是已知的,但是类别未知,其亦可参与训练,此时矩阵A的shape=[34, 34+N],其它不变,然后进行训练,训练完成后,这N个node的类别是可以被这个训练完的模型预测的。
3.3 多layer多类别的情况
【GCN】图卷积网络 Graph Convolutional Networks
附代码:
https://link.zhihu.com/?target=https%3A//github.com/frank0532/graph_convolutional_networks
<pre style="max-width: 100%;letter-spacing: 0.544px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="margin-right: 8px;margin-left: 8px;max-width: 100%;white-space: normal;color: rgb(0, 0, 0);font-family: -apple-system-font, system-ui, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;letter-spacing: 0.544px;text-align: center;widows: 1;line-height: 1.75em;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;letter-spacing: 0.5px;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;font-size: 16px;letter-spacing: 0.544px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;letter-spacing: 0.5px;box-sizing: border-box !important;overflow-wrap: break-word !important;">—</span></strong>完<strong style="max-width: 100%;font-size: 16px;letter-spacing: 0.544px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;letter-spacing: 0.5px;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;font-size: 16px;letter-spacing: 0.544px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;letter-spacing: 0.5px;box-sizing: border-box !important;overflow-wrap: break-word !important;">—</span></strong></span></strong></span></strong></section><section style="max-width: 100%;white-space: normal;font-family: -apple-system-font, system-ui, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;letter-spacing: 0.544px;text-align: center;widows: 1;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section powered-by="xiumi.us" style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="margin-top: 15px;margin-bottom: 25px;max-width: 100%;opacity: 0.8;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="max-width: 100%;letter-spacing: 0.544px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section powered-by="xiumi.us" style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="margin-top: 15px;margin-bottom: 25px;max-width: 100%;opacity: 0.8;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="margin-right: 8px;margin-bottom: 15px;margin-left: 8px;padding-right: 0em;padding-left: 0em;max-width: 100%;color: rgb(127, 127, 127);font-size: 12px;font-family: sans-serif;line-height: 25.5938px;letter-spacing: 3px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(0, 0, 0);box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;font-size: 16px;font-family: 微软雅黑;caret-color: red;box-sizing: border-box !important;overflow-wrap: break-word !important;">为您推荐</span></strong></span></section><p style="margin-right: 8px;margin-bottom: 5px;margin-left: 8px;padding-right: 0em;padding-left: 0em;max-width: 100%;min-height: 1em;color: rgb(127, 127, 127);font-size: 12px;font-family: sans-serif;line-height: 1.75em;letter-spacing: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;">“12306”的架构到底有多牛逼?</p><p style="margin-right: 8px;margin-bottom: 5px;margin-left: 8px;padding-right: 0em;padding-left: 0em;max-width: 100%;min-height: 1em;color: rgb(127, 127, 127);font-size: 12px;font-family: sans-serif;line-height: 1.75em;letter-spacing: 0px;box-sizing: border-box !important;overflow-wrap: break-word !important;">一文回顾深度学习十年发展<br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /></p><section style="margin-right: 8px;margin-bottom: 5px;margin-left: 8px;padding-right: 0em;padding-left: 0em;max-width: 100%;min-height: 1em;color: rgb(127, 127, 127);font-size: 12px;font-family: sans-serif;letter-spacing: 0px;line-height: 1.75em;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;-webkit-tap-highlight-color: rgba(0, 0, 0, 0);cursor: pointer;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;">阿里如何抗住90秒100亿?看这篇你就明白了!</span></section><section style="margin-right: 8px;margin-bottom: 5px;margin-left: 8px;padding-right: 0em;padding-left: 0em;max-width: 100%;min-height: 1em;font-family: sans-serif;letter-spacing: 0px;line-height: 1.75em;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;color: rgb(87, 107, 149);box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;">60个Chrome神器插件大收集:助你快速成为老司机,一键分析网站技术栈</span></span><br style="max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"  /></section><section style="margin-right: 8px;margin-bottom: 5px;margin-left: 8px;padding-right: 0em;padding-left: 0em;max-width: 100%;min-height: 1em;color: rgb(127, 127, 127);font-size: 12px;font-family: sans-serif;letter-spacing: 0px;line-height: 1.75em;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max-width: 100%;-webkit-tap-highlight-color: rgba(0, 0, 0, 0);cursor: pointer;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;">深度学习必懂的13种概率分布</span></section></section></section></section></section></section></section></section></section>

本篇文章来源于: 深度学习这件小事

本文为原创文章,版权归所有,欢迎分享本文,转载请保留出处!

知行编程网
知行编程网 关注:1    粉丝:1
这个人很懒,什么都没写

发表评论

表情 格式 链接 私密 签到
扫一扫二维码分享