半监督节点分类:标签传播和消息传递

半监督节点分类问题的常见解决方法:

  • 特征工程
  • 图嵌入表示学习
  • 标签传播
  • 图神经网络

基于“物以类聚,人以群分”的Homophily假设,讲解了Label Propagation、Relational Classification(标签传播)、Iterative Classification、Correct & Smooth(C & S)、Loopy Belief Propagation(消息传递)、Masked Lable Prediction等半监督和自监督节点分类方法。这些方法经常被用于节点分类任务的Baseline比较基线。消息传递和聚合的思路也影响了后续图神经网络的设计。

半监督节点分类 Transductive 直推式学习<->Inductive 归纳式学习

半监督节点分类问题求解思路

  • 节点特征工程
  • 节点表示学习(图嵌入)
  • 标签传播(消息传递)
  • 图神经网络

半监督节点分类问题-求解方法对比

方法

图嵌入

表示学习

使用属性特征

使用标注

直推式

归纳式

人工特征工程





/

/

基于随机游走的方法







基于矩阵分解的方法







标签传播



是/否




图神经网络







  • 人工特征工程:节点重要度、集群系数、Graphlet等。
  • 基于随机游走的方法,构造自监督表示学习任务实现图嵌入。无法泛化到新节点。
    例如:DeepWalk、Node2Vec、LINE、SDNE等。
  • 标签传播:假设“物以类聚,人以群分”,利用邻域节点类别猜测当前节点类别。无法泛化到新节点。
    例如:Label Propagation、Iterative Classification、Belief Propagation、Correct & Smooth等。
  • 图神经网络:利用深度学习和神经网络,构造邻域节点信息聚合计算图,实现节点嵌入和类别预测。
    可泛化到新节点。
    例如:GCN、GraphSAGE、GAT、GIN等。

标签传播和集体分类

  • Label Propagation(Relational Classification)
  • Iterative Classification
  • Correct & Smooth
  • Belief Propagation
  • Masked Lable Prediction

具有相似属性特征的节点更可能相连且有相同类别
具有相似属性特征的节点更可能相连且具有相同类别

社群检测算法代码

# 运行社群检测算法
from networkx.algorithms import community
communities = community.label_propagation_communities(G)

#获得每个社群的节点
node_groups = []
for com in communities:
	node_groups.append(list(com))
print(node_groups)

#每个社群的分配颜色
color_mpa = []
for node_id in G:
	if node_id in node_groups[0]:
		color_map.append('blue')
	elif node_id in node_groups[1]:
		color_map.append('red')
	else:
		color_map.append('green')

#可视化
nx.draw(G,node_color=color_map,with_labels = True)
pit.show()