GCN: Graph Convolutional Networks PGL详解

Graph Convolutional Network (GCN) is a powerful neural network designed for machine learning on graphs. Based on PGL, we reproduce GCN algorithms and reach the same level of indicators as the paper in citation network benchmarks.

图卷积网络(GCN)是一个功能强大的神经网络,旨在用于图上的机器学习。基于PGL,我们重现了GCN算法,并达到了与引用网络基准中的论文相同的指标水平。

Simple example to build GCN

构建GCN的简单示例

 

To build a gcn layer, one can use our pre-defined pgl.layers.gcn or just write a gcn layer with message passing interface.

 

import paddle.fluid as fluid
def gcn_layer(graph_wrapper, node_feature, hidden_size, act):
    def send_func(src_feat, dst_feat, edge_feat):
        return src_feat["h"]

    def recv_func(msg):
        return fluid.layers.sequence_pool(msg, "sum")

    message = graph_wrapper.send(send_func, nfeat_list=[("h", node_feature)])
    output = graph_wrapper.recv(recv_func, message)
    output = fluid.layers.fc(output, size=hidden_size, act=act)
    return output

Datasets

数据集

The datasets contain three citation networks: CORA, PUBMED, CITESEER. The details for these three datasets can be found in the paper.

本demo展示了在CORA, PUBMED, CITESEER数据集上面的表现,数据集的详细介绍可以看论文【Semi-Supervised Classification with Graph Convolutional Networks】

Dependencies

需要的包

  • paddlepaddle>=1.6

飞桨1.6版本

  • pgl

飞桨图神经网络学习框架

Performance

We train our models for 200 epochs and report the accuracy on the test dataset.

Dataset

Accuracy

Cora

~81%

Pubmed

~79%

Citeseer

~71%

How to run

如何去运行

For examples, use gpu to train gcn on cora dataset.

例如,你可以用下面的命令在GPU上开始你的训练

python train.py --dataset cora --use_cuda

Hyperparameters

参数

  • dataset: The citation dataset “cora”, “citeseer”, “pubmed”.

配置数据集,可选数据集有cora citeseer pubmed

  • use_cuda: Use gpu if assign use_cuda.

是否使用GPU加速科学计算

数据集介绍

Semi-Supervised Classification with Graph Convolutional Networks

 

你可能感兴趣的:(GCN: Graph Convolutional Networks PGL详解)