【论文笔记】MAGNN: Metapath Aggregated Graph Neural Network for Heterogeneous Graph Embedding

MAGNN模型针对异构图表示学习中的三个问题提出解决方案:合理利用节点属性特征,提取元路径实例信息并评估其重要性,综合多种元路径信息进行节点嵌入。通过这三个步骤,MAGNN能够有效捕捉图中复杂结构和语义信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

该论文发布与WWW '20

1.Task

异构图表示学习

2.Motivation

先前的工作存在如下问题:

  1. 忽略节点的属性特征
  2. 舍弃元路径内部节点,仅使用元路径中的头尾节点
  3. 仅使一种元路径

3.Methodology

为解决上述三个问题,作者提出了MAGNN,该模型含有三个组件,每个组件对应解决上述提到的三个问题:

3.1 node content transformation

目的:合理利用节点的属性特征
动机:使用节点的原始属性特征面临以下两个问题:

  1. 不同类型节点的属性特征维度可能不同
  2. 若特征维度相同,特征向量也并非存在于同一个特征空间

方法:通过给每个节点类型都设置了参数W来将其特征映射到同一个特征空间中
在这里插入图片描述

3.2 intra-metapath aggregation

目的:使得节点嵌入包含某种metapath的结构和语义信息
动机和方法:1.metapath的内部节点含有可利用的信息,因此提出了mepath instance encoder。2.同类metapath下不同的实例重要程度不同,因此使用了attention。

metapath instance encoder:

  1. Mean
  2. Linear:mean后再线性变换
  3. Relational rotation:前两种方法将metapath中的点看作集合处理,而忽略了metapath中的序列信息。引入两两节点之间的关系向量r来获得该metapath embedding
    在这里插入图片描述

graph attention layer

输入:目标节点v和该节点所在的metapath,输出:该节点在该metapath下的embedding

通过该组件,可以获得任一节点v(节点类型为A,A可以是任一节点类型)在所有以A为起始或终止节点的metapath下的embedding

3.3 inter-metapath aggregation

目的:使得node embedding含有丰富的结构、语义信息
动机:每个节点在不同metapath下的信息不同,并且不同metapath在异构图中的重要性不同
方法:
1.得到每种metapth的embedding
在这里插入图片描述

2.计算每条metapath在该类metapath(以同一节点类型起始或终止的metapath)下的权重占比
3.目标节点v最终embedding = 某metapath下的embedding * 该metapath权重的加权和
在这里插入图片描述

4.最后再加一层映射
在这里插入图片描述

3.4 总流程

在这里插入图片描述

3.5 训练策略

1.半监督(用于node classification&node clustering):使用带有label的节点最小化交叉熵损失
2.无监督(用于link prediction):原理与对比学习类似。正样本对为图中连接的边,负样本对为未连接的同类型边
在这里插入图片描述

4. Datasets

  1. node classification & node clustering:
    1. IMDB(movie节点有label:Action, Comedy, and Drama)
    2. DBLP(author节点有label:Database, Data Mining, Artificial Intelligence,
      and Information Retrieval)
  2. link predication:Last.fm(无label无feature)

5. Metrics

  1. node classification(SVM):Marco-F1、Micro-F1
  2. node clustering(K-Means):normalized mutual information (NMI) and adjusted Rand
    index (ARI)
  3. link prediction:area under the ROC curve (AUC) and average precision (AP)

6. About baseline

  1. traditional homogeneous models:
    1. LINE
    2. node2vec
  2. traditional heterogeneous models
    1. ESim
    2. metapath2vec
    3. HERec
  3. homogeneous GNNs
    1. GCN
    2. GAT
  4. heterogeneous GNNs
    1. GATNE
    2. HAN
      在这里插入图片描述

7. Questions and Ideas

7.1 Graph attention的原理?

不理解为什么两个节点向量拼接后经过参数矩阵的点积映射为的标量表示为注意力值。站在模型训练优化目标视角上可以有所感觉,但是不能理解。

7.2 inter-metapath aggregation选取的metapath的合理性?

节点v(类型为A)提取信息时利用以节点类型A起始或终止的metapath(如A-P-A或A-P-P-A),但并不包括A位于路径内部节点的metapath(如P-A-P,而P-A-P是用于提取类型P的节点时使用的metapath),这样是否存在信息损失?

7.3 Relational rotation encoder中的关系向量r是如何得到的?

8. “One sentence” summary

To solve three previous problems(omit nodes’ attribute feature, do not use the intermediate nodes in the metapath, and only apply one kind of metapath) in heterogeneous graph embedding works, MAGNN proposed three main components to handle these problems correspondingly. First, MAGNN uses node content transformation to ensure the original feature of all kinds of nodes is in the same vector space. Second, MAGNN applies metapath instance encoder to extract the structure and semantic information of the metapath instance which can later be used to calculate the importance of the metapath instance to the target node by using graph attention mechanism, after that we can obtain different representations of target node in different metapaths. Third, the attention mechanism is applied to assign different weights to different metapaths which helps to aggregate a more comprehensive node embedding.

### Graph Isomorphism Network (GIN): 原理、实现与应用 #### GIN 的基本概念 Graph Isomorphism Network (GIN) 是一种用于图结构数据处理的强大神经网络模型。它通过设计特定的消息传递机制来捕获节点之间的关系,从而能够区分不同类型的图结构[^1]。 #### 工作原理 GIN 的核心在于消息传递机制的设计以及如何利用聚合函数来更新节点特征。具体来说,GIN 使用了一种形式化的表达方式 \( h_v^{(k+1)} = \text{MLP}(h_v^{(k)} + \text{AGG}(\{h_u^{(k)}, u\in N(v)\}))\) 来描述节点状态的更新过程。其中: - \( h_v^{(k)} \) 表示第 k 层中节点 v 的隐藏状态; - \( N(v) \) 表示节点 v 的邻居集合; - AGG 表示某种聚合操作(通常为求和或平均); - MLP 表示多层感知器。 这种设计使得 GIN 能够逼近 Weisfeiler-Lehman 图同构测试的能力,因此具有较强的表征能力。 #### 实现细节 在实际实现过程中,可以借助流行的深度学习框架完成 GIN 的构建。以下是基于 Python 和 JAX 库的一个简单代码示例: ```python import jax.numpy as jnp from flax import linen as nn class GINLayer(nn.Module): mlp: nn.Module @nn.compact def __call__(self, node_features, adjacency_matrix): aggregated_messages = jnp.dot(adjacency_matrix, node_features) updated_node_features = self.mlp(node_features + aggregated_messages) return updated_node_features class GINModel(nn.Module): num_layers: int hidden_dim: int output_dim: int @nn.compact def __call__(self, node_features, adjacency_matrix): for _ in range(self.num_layers - 1): mlp_layer = nn.Sequential([nn.Dense(self.hidden_dim), nn.ReLU()]) gin_layer = GINLayer(mlp=mlp_layer) node_features = gin_layer(node_features, adjacency_matrix) final_mlp = nn.Sequential([ nn.Dense(self.output_dim), nn.LogSoftmax() ]) return final_mlp(node_features) # Example usage of the model node_features = jnp.array([[0., 1.], [1., 0.]]) # Example features adjacency_matrix = jnp.array([[0., 1.], [1., 0.]]) # Example graph structure model = GINModel(num_layers=2, hidden_dim=8, output_dim=3) params = model.init(jax.random.PRNGKey(0), node_features, adjacency_matrix) output = model.apply(params, node_features, adjacency_matrix) print(output) ``` 上述代码展示了如何定义一个简单的 GIN 模型并对其进行初始化和前向传播计算。 #### 应用领域 GIN 广泛应用于多个机器学习场景,特别是在涉及复杂图结构的任务上表现优异。常见的应用场景包括但不限于分子性质预测、社交网络分析和社会科学中的群体行为建模等。
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值