想法:在GCN层内部加入残差进行特征变换,在层之间加入注意力矩阵对不同层的输出赋予权重,最后加一个激活函数进行分类。
在此之前,想弄明白一个东西,GCN的tricks有哪些
参考论文《Bag of Tricks for Node Classification with Graph Neural Networks》
配套的ogbn-arxiv代码:https://github.com/Espylapiza/dgl/tree/master/examples/pytorch/ogb/ogbn-arxiv
希望我自己能实验
一、特征变换部分
加入负二阶差分以及恒等映射
二、传播过程
想要通过一个机制,赋予不同层之间一个权重再输出
1.将所有层得到的特征进行加和
2. 将所有层得到的特征输入给注意力机制,
3.hop-attention(aero-GNN)
层、模型的实例调用
1. GCN:
直接使用PyG的GCNConV
GCNConv(in_channels, out_channels)
定义模型GCNnet
class GCNnet(nn.Module):
def __init__(self, dataset, hidden=256, num_layers=3):
.
.
.
def forward(self, data):
.
.
.
return x
调用:
model = GCNNet(dataset=dataset, hidden=256, num_layers=3)
2. GCNII
GCNIIdenseConv(hidden_channels, hidden_channels,bias=norm)
class GCNIIdense_model(torch.nn.Module):
def __init__(self, in_channels, hidden_channels, out_channels, num_layers,dropout,alpha,norm):
.
.
.
def forward(self,data):
..
#调用
model = GCNIIdense_model(data.x.size(-1), args.hidden_channels,
dataset.num_classes, args.num_layers,
args.dropout,args.alpha,args.norm).to(device)
3.GCN_res_sum
model = GCN_res(dataset=dataset, hidden=128, num_layers=8)
动手部分
模型/准确率 | 训练准确率 | 测试准确率 | ||
GCN_res_sum_8layer | 77.80±0.39 | 72.83±0.26 | ||
GCN_3layer | 78.21 ± 1.14 | 71.69 ± 0.34 | ||
clenshawGCN_4layer | 70.18 ± 0.07 | 68.13 ± 0.10 | ||
clenshawgcn_9layer | 72.21 ± 1.01 | 67.48 ± 0.27 | ||
GCN_clen_sum | ||||
GCNII_16 | 72.54±0.17 | |||
GCN_clen_attention |
1. GCN_res