9、图注意力网络(Graph Attention Networks)详解

图注意力网络(Graph Attention Networks)详解

1. 技术要求

所有代码示例可在 GitHub 上找到,链接为:https://github.com/PacktPublishing/Hands-On-Graph-Neural-Networks-Using-Python/tree/main/Chapter07 。在本地机器上运行代码所需的安装步骤可按需查找对应指引。

2. 图注意力层介绍

图注意力网络(GATs)的核心思想是,部分节点比其他节点更为重要。在图卷积层中,就已经存在这种情况,由于归一化系数的存在,邻居较少的节点相对更重要。然而,这种方法存在局限性,因为它仅考虑了节点的度。而图注意力层的目标是生成考虑节点特征重要性的加权因子。

我们将这些加权因子称为注意力分数,用 $\alpha_{ij}$ 表示节点 $i$ 和节点 $j$ 之间的注意力分数。图注意力算子可定义如下:
[h_i = \sum_{j \in \mathcal{N} i} \alpha {ij} \mathbf{W} x_j]

GATs 的一个重要特性是,注意力分数是通过相互比较输入来隐式计算的(因此称为自注意力)。计算这些注意力分数可分为以下四个步骤,同时还可以对图注意力层进行改进:
1. 线性变换
2. 激活函数
3. Softmax 归一化
4. 多头注意力
5. 改进的图注意力层

相关推荐

Graph Attention Network (GAT) 图注意力模型

文章目录 GAT模型的提出,可见ICLR 2018论文 GRAPH ATTENTION NETWORKS

酒酿小圆子呀~ 1万+

【图注意力网络】GAT:Graph Attention Networks

Graph Attention Networks(图注意力网络)

CRW__DREAM的博客 3665

Att论文解读|ICLR 2018 《Graph attention networks》图注意力网络

我们提出了图注意力网络(GATs),这是一种可在图结构数据上运行的新型神经网络架构,它利用掩码自注意力层来解决之前基于图卷积或其近似值的方法的不足之处。通过堆叠节点能够关注其邻域特征的层,我们能够(隐式地)为邻域中的不同节点指定不同的权重,而不需要任何形式的代价高昂的矩阵运算(如反转),也不依赖于对图结构的预先了解。通过这种方式,我们同时解决了基于谱的图神经网络所面临的几个关键挑战,并使我们的模型可随时应用于归纳和转换问题。

YuZhou的博客 3194

关联性图注意力网络:Relational Graph Attention Networks(ICLR2019)

Relational Graph Attention Networks(ICLR2019)关联性图注意力网络 论文地址:https://openreview.net/forum?id=Bklzkh0qFm&noteId=HJxMHja3Y7 解析: 这篇论文整合了GCN+Attention+Relational三个内容来实现网络的节点表示进行节点分类和图分类任务,论文思路很简单,但是...

luoxuexiong的博客 1万+

图注意力网络GAT - 《Graph Attention Networks》论文详解

图注意力网络GAT论文详解

November、Chopin 4416

GRAPH ATTENTION NETWORKS--论文阅读笔记

摘要 该论文发表于2018年ICLR(International Conference on Learning Representations)国际学习表征会议 一、摘要## 标题       作者提出了图注意网络graph attention networks(GATS),它是一种操作于图结构数据,利用屏蔽的自我注意层(leveragi...

LIYUO94的博客 2972

Graph Attention Networks

Introduction 针对图结构数据,本文提出了一种GAT(graph attention networks)网络。该网络使用masked self-attention层解决了之前基于图卷积(或其近似)的模型所存在的问题。在GAT中,图中的每个节点可以根据邻节点的特征,为其分配不同的权值。GAT的另一个优点在于,无需使用预先构建好的图。因此,GAT可以解决一些基于谱的图神经网络中所具有的问题...

NockinOnHeavensDoor的博客 2436

GRAPH ATTENTION NETWORKS

GRAPH ATTENTION NETWORKS 【GATs】 本文提出了图注意力网络(GATs),这是一种新的作用在图结构数据上的神经网络框架。 作者利用注意力机制已达到对节点分类的任务取得更好的效果。 Cora数据集: 包含2708个节点,每个样本点都是一篇科学论文,5429个边 每篇论文都由一个1433维的词向量表示,即每个节点1433个特征。 GAT 网络架构 通过堆叠单个的图注意力层(G...

qwertyuiopazure的博客 632

GRAPH ATTENTION NETWORKS图注意力网络

GRAPH ATTENTION NETWORKS 图注意力网络 2.GAT架构 2.1 GRAPH ATTENTIONAL LAYER 从一个单层图注意力层开始介绍 输入:节点特征: ​ ( N 是节点数量 ,F是节点特征数量) 输出是一个新的节点特征 为了把输入的特征变为输出特征,引入一个权重矩阵W(F’行F列) 接着对每个节点实施self-attention] 计算注意力系数 这一系数代表节点j的特征对节点i的重要程度(节点j是节点i的相邻节点) 为了方便比较不同

modige_hm的博客 332

图神经网络实战(8)——图注意力网络(Graph Attention Networks, GAT)

图注意力网络 (Graph Attention Networks, GAT) 是对图卷积网络 (Graph Convolutional Network, GCN) 的改进,提出了一种通过自注意力 (self-attention) 过程计算的加权因子,而不是使用静态的归一化系数。在本节中,我们介绍了 GAT 架构。通过从线性变换到多头注意力的四个主要步骤,了解了 GAT 的工作原理,并在 NumPy 中从零开始构建了 GAT 层。最后,将 GAT 模型应用于 Cora 和 CiteSeer 数据集。

盼小辉丶的博客 1万+

Halcon 3D视觉实战:5步将线激光高度数据转为可分析的深度图与点云

本文详细介绍了如何利用Halcon平台将线激光高度数据转换为深度图与点云的5步实战方法。通过具体代码示例和工业检测案例(如锂电池胶水测量),帮助工程师高效处理3D视觉数据,实现从原始数据到三维可视化的完整技术链路。

weixin_29039773的博客 361

论文解析-sciPENN

用这2个CITE-seq共有的protein作为训练集,分别将他们特有的protein作为测试集,评估sciPENN对CITE-seq数据集中缺失的protein丰度预测准确度。来自Seurat 4 的PBMC数据集,样本被注射水疱性口炎病毒 (VSV) 载体 HIV 疫苗,数据集包含每个样本注射疫苗0天、3天、7天的CITE-seq数据。PBMCs作为训练集,MALT作为测试集,利用scRNA-seq测试17个蛋白质表达水平。Monocyte:随机取4个样本作为训练集,剩余4个样本作为测试集。

weixin_46065198的博客 1023

ENVI遥感技术

记录2024.03.06所遇到的遥感问题

qq_44453923的博客 4332

DRAM架构演进与HBM技术在高性能计算中的应用

DRAM(动态随机存取存储器)是现代计算系统中关键的内存技术,其架构优化直接影响数据供给能力。随着AI训练和科学计算等数据密集型负载的普及,传统DDR架构面临带宽墙、能效比和访问粒度等挑战。HBM(高带宽内存)通过3D堆叠技术(如TSV硅通孔)和异构集成(如PIM存内计算)显著提升了带宽和能效比。这些技术在高性能计算、AI推理和大模型训练等场景中展现出巨大潜力,例如HBM3的带宽可达819GB/s,能效比低至0.95pJ/b。未来,DRAM技术将继续向更高密度、更低功耗和更智能的内存计算方向发展。

weixin_35757191的博客 400

/proc/sys/vm/max_map_count耗尽时,调用glibc 2.11.3 free()导致程序crash,问题追踪和解决

1. 问题 在客户环境下,当我们的程序消耗较大内存时,会偶尔crash。 通过gdb分析,程序core dump在malloc/free函数内。 当把/proc/sys/vm/max_map_count 从65530增加到131070,程序再也不crash。 相关命令 echo 131073 > /proc/sys/vm/max_map_count 2.  core

万大胖博客,苦并快乐着 4430

分享一下使用Xilinx FPGA驱动MIPI DSI LCD屏的心路历程

分享一下调试用Xilinx FPGA驱动MIPI DSI LCD屏的心路历程,看到的朋友们,可以避免继续踩坑。

haoxingheng的专栏 5017

lgv20刷twrp_LG港版v20 root

这是LG港版v20 root,整理了一下有关LG港版v20的官方固件包了,有没有需要的呢,这里把固件包整理一下也是方便大家以后好下载了,因此有一些机友还是不知道在哪里下载官方的rom包,在这里说的固件rom包也就是原版的系统包了,大家可以放心的使用,这些系统包也都是支持线刷的,大家下载下来解压出来根据里面的相关教程来操作就可以了,很简单的,如果你也需要的话就一起来看看吧。软件提示注意!! 此过程会...

weixin_33212263的博客 5390

【AI大模型应用开发】【RAG评估】0. 综述:一文了解RAG评估方法、工具与指标

本文主要总结了当前比较流行的RAG评估方法和指标。当前AI技术的快速发展,RAG和RAG评估是当前比较有前景的发展方向,不断有新的评估工具和理论被提出,让我们持续跟进,了解这些工具和理论,从而在使用时知道如何选择。

同学小张的博客 6832

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain&#39;s apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath(&#39;DeepLearnToolbox&#39;));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand(&#39;state&#39;,0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = &#39;sigm&#39;;%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, &#39;Too big error&#39;);```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, &#39;Too big error&#39;);```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

上一篇: 64、航空电子系统架构与雷达天线双同步驱动技术研究
下一篇: 41、机器学习数据标注:从原理到界面设计
code8
博客等级 码龄17年 65粉丝 1720原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值