项目作者: yuehaowang

项目描述 :
SoGCN: Second-Order Graph Convolutional Networks
高级语言: Jupyter Notebook
项目地址: git://github.com/yuehaowang/SoGCN.git
创建时间: 2021-02-12T10:28:54Z
项目社区:https://github.com/yuehaowang/SoGCN

开源协议:

下载


SoGCN: Second-Order Graph Convolutional Networks

License: MIT

The official implementation of paper SoGCN: Second-Order Graph Convolutional Networks.

Peihao Wang*, Yuehao Wang*, Hua Lin, Jianbo Shi

Requirements

For the GNN benchmarking part, our experiments are based on GNN Benchmark. Please follow the instructions in Benchmark Installation to install the running environment. Our code is tested with PyTorch 1.3.1 + Cuda Toolkit 10.0.

For the experiments on OGB Open Graph Benchmark, we built our models based on offical code. Please follow the instructions in Getting Started to configure the running environment. Our code is tested with PyTorch 1.4.0 + Cuda Toolkit 10.1.

Our experiments is conducted on a 4-core Nvidia Quadro P6000 GPU running on Ubuntu 18.04.2 LTS.

Reproduce Results

For SGS and GNN benchmark datasets, we provide a script named ‘scripts/exp.py’ to run a series of model training in screen sessions. You can type python scripts/exp.py -h to view its usage. To OGB benchmark dataset, we provide shell scripts ‘scripts/run_ogbn_proteins.sh’ and ‘scripts/run_ogbg_molhiv.sh’ to reproduce results with our hyper-parameter settings.

For convenience, below presents the commands to reproduce our results.

Synthetic Graph Spectrum Dataset

To train models on SGS datasets, run the following commands:

  1. ## High-Pass
  2. python scripts/exp.py -a start -e highpass_sogcn -t SGS -g 1111 --dataset SGS_HIGH_PASS --config 'configs/SGS_node_regression_SoGCN.json'
  3. python scripts/exp.py -a start -e highpass_sogcn -t SGS -g 1111 --dataset SGS_HIGH_PASS --config 'configs/SGS_node_regression_GCN.json'
  4. python scripts/exp.py -a start -e highpass_sogcn -t SGS -g 1111 --dataset SGS_HIGH_PASS --config 'configs/SGS_node_regression_GIN.json'
  5. ## Low-Pass
  6. python scripts/exp.py -a start -e lowpass_sogcn -t SGS -g 1111 --dataset SGS_LOW_PASS --config 'configs/SGS_node_regression_SoGCN.json'
  7. python scripts/exp.py -a start -e lowpass_sogcn -t SGS -g 1111 --dataset SGS_LOW_PASS --config 'configs/SGS_node_regression_GCN.json'
  8. python scripts/exp.py -a start -e lowpass_sogcn -t SGS -g 1111 --dataset SGS_LOW_PASS --config 'configs/SGS_node_regression_GIN.json'
  9. ## Band-Pass
  10. python scripts/exp.py -a start -e bandpass_sogcn -t SGS -g 1111 --dataset SGS_BAND_PASS --config 'configs/SGS_node_regression_SoGCN.json'
  11. python scripts/exp.py -a start -e bandpass_sogcn -t SGS -g 1111 --dataset SGS_BAND_PASS --config 'configs/SGS_node_regression_GCN.json'
  12. python scripts/exp.py -a start -e bandpass_sogcn -t SGS -g 1111 --dataset SGS_BAND_PASS --config 'configs/SGS_node_regression_GIN.json'

Note the results will be saved to ‘_out/SGS_node_regression/‘.

Open Graph Benchmarks

Running the following commands will reproduce our results on Open Graph Benchmark datasets:

  1. scripts/run_ogbn_proteins.sh <log_dir> [<gpu_id>] [--test]
  2. scripts/run_ogbg_molhiv.sh <log_dir> [<gpu_id>] [--test]

where log_dir specifies the folder to load or save output logs. The downloaded log files will be saved in _out/protein_nodeproppred and _out/molhiv_graphproppred for ogbn-protein and ogbn-molhiv datasets, respectively. gpu_id specifies the GPU device to run our models. Add --test if you only want to reload the log files and read out the testing results. The OGB dataset will be automatically downloaded into data/OGB directory at the first run.

To download the saved log files for ogb datasets, please run the following scripts:

  1. bash scripts/download_logfiles_ogb.sh

GNN Benchmarks

To test on our pretrained models on GNN benchmarks, please follow the steps as below:

  1. Download our pretrained models.
  1. # make sure the commands below are executed in the root directory of this project
  2. bash scripts/download_pretrained_molecules.sh
  3. bash scripts/download_pretrained_superpixels.sh
  4. bash scripts/download_pretrained_SBMs.sh

Pretrained models will be downloaded to ‘_out/molecules_graph_regression’, ‘_out/superpixels_graph_classification’, ‘_out/SBMs_node_classification’, respectively.

  1. Type the commands for different tasks

Molecules Graph Regression

  1. ## ZINC
  2. python main_molecules_graph_regression.py --model SoGCN --dataset ZINC --gpu_id 0 --test True --out_dir _out/molecules_graph_regression/zinc_sogcn
  3. python main_molecules_graph_regression.py --model SoGCN --dataset ZINC --gpu_id 0 --test True --out_dir _out/molecules_graph_regression/zinc_sogcn_gru

Superpixels Graph Classification

  1. ## MNIST
  2. python main_superpixels_graph_classification.py --model SoGCN --dataset MNIST --gpu_id 0 --test True --out_dir _out/superpixels_graph_classification/mnist_sogcn
  3. python main_superpixels_graph_classification.py --model SoGCN --dataset MNIST --gpu_id 0 --test True --out_dir _out/superpixels_graph_classification/mnist_sogcn_gru
  4. ## CIFAR10
  5. python main_superpixels_graph_classification.py --model SoGCN --dataset CIFAR10 --gpu_id 0 --test True --out_dir _out/superpixels_graph_classification/cifar10_sogcn
  6. python main_superpixels_graph_classification.py --model SoGCN --dataset CIFAR10 --gpu_id 0 --test True --out_dir _out/superpixels_graph_classification/cifar10_sogcn_gru

SBMs Node Classification

  1. ## CLUSTER
  2. python main_SBMs_node_classification.py --model SoGCN --dataset SBM_CLUSTER --verbose True --gpu_id 0 --test True --out_dir _out/SBMs_node_classification/cluster_sogcn
  3. python main_SBMs_node_classification.py --model SoGCN --dataset SBM_CLUSTER --verbose True --gpu_id 0 --test True --out_dir _out/SBMs_node_classification/cluster_sogcn_gru
  4. ## PATTERN
  5. python main_SBMs_node_classification.py --model SoGCN --dataset SBM_PATTERN --verbose True --gpu_id 0 --test True --out_dir _out/SBMs_node_classification/pattern_sogcn
  6. python main_SBMs_node_classification.py --model SoGCN --dataset SBM_PATTERN --verbose True --gpu_id 0 --test True --out_dir _out/SBMs_node_classification/pattern_sogcn_gru

Citation

If you find this repo helpful, please cite

  1. @misc{wang2021sogcn,
  2. title={SoGCN: Second-Order Graph Convolutional Networks},
  3. author={Wang, Peihao and Wang, Yuehao and Lin, Hua and Shi, Jianbo},
  4. year={2021},
  5. eprint={2110.07141},
  6. archivePrefix={arXiv},
  7. primaryClass={cs.LG}
  8. }