official implementation for the paper "Simplifying Graph Convolutional Networks"

Overview

Simplifying Graph Convolutional Networks

made-with-python License: MIT

Updates

  • As pointed out by #23, there was a subtle bug in our preprocessing code for the reddit dataset. After fixing this bug, SGC achieves a F1 score of 95.0 (previously, it was 94.9).
  • Practical advice: it is often very helpful to normalize the features to have zero mean with standard deviation one to accelerate the convergence of SGC (and many other linear models). For example, we apply this normalization for the reddit dataset. Please consider doing this when applying SGC to other datasets. For some relevant discussions, see Ross et al, 2013 and Li and Zhang, 1998.

Authors:

*: Equal Contribution

Overview

This repo contains an example implementation of the Simple Graph Convolution (SGC) model, described in the ICML2019 paper Simplifying Graph Convolutional Networks.

SGC removes the nonlinearities and collapes the weight matrices in Graph Convolutional Networks (GCNs) and is essentially a linear model. For an illustration,

SGC achieves competitive performance while saving much training time. For reference, on a GTX 1080 Ti,

Dataset Metric Training Time
Cora Acc: 81.0 % 0.13s
Citeseer Acc: 71.9 % 0.14s
Pubmed Acc: 78.9 % 0.29s
Reddit F1: 94.9 % 2.7s

This home repo contains the implementation for citation networks (Cora, Citeseer, and Pubmed) and social network (Reddit). We have a work-in-progress branch ablation, containing additional codebase for our ablation studies.

If you find this repo useful, please cite:

@InProceedings{pmlr-v97-wu19e,
  title = 	 {Simplifying Graph Convolutional Networks},
  author = 	 {Wu, Felix and Souza, Amauri and Zhang, Tianyi and Fifty, Christopher and Yu, Tao and Weinberger, Kilian},
  booktitle = 	 {Proceedings of the 36th International Conference on Machine Learning},
  pages = 	 {6861--6871},
  year = 	 {2019},
  publisher = 	 {PMLR},
}

Other reference implementations

Other reference implementations can be found in the follwing libraries. Note that in these examples, the hyperparameters are potentially different and the results would be different from the paper reported ones.

Dependencies

Our implementation works with PyTorch>=1.0.0 Install other dependencies: $ pip install -r requirement.txt

Data

We provide the citation network datasets under data/, which corresponds to the public data splits. Due to space limit, please download reddit dataset from FastGCN and put reddit_adj.npz, reddit.npz under data/.

Usage

Citation Networks: We tune the only hyperparameter, weight decay, with hyperopt and put the resulting hyperparameter under SGC-tuning. See tuning.py for more details on hyperparameter optimization.

$ python citation.py --dataset cora --tuned
$ python citation.py --dataset citeseer --tuned --epochs 150 
$ python citation.py --dataset pubmed --tuned

Reddit:

$ python reddit.py --inductive --test

Downstream

We collect the code base for downstream tasks under downstream. Currently, we are releasing only SGC implementation for text classification.

Acknowledgement

This repo is modified from pygcn, and FastGCN.

We thank Deep Graph Library team for helping providing a reference implementation of SGC and benchmarking SGC in Deep Graph Library. We thank Matthias Fey, author of PyTorch Geometric, for his help on providing a reference implementation of SGC within PyTorch Geometric. We thank Daniele Grattarola, author of Spektral, for his help on providing a reference implementation of SGC within Spektral.

Comments
  • node embeddings from SGC

    node embeddings from SGC

    Quick questions. It looks like that SGC does not generate node embedding. Instead, SGC generates N*C whereas C refers to the number of classes. Does it imply that SGC could not generate node embeddings?

    opened by titaniumrain 8
  • Memory Error

    Memory Error

    While running train.py from downstream/TextSGC a Memory Error occurs. "SGC\downstream\TextSGC\utils.py", line 177, in sparse_to_torch_dense dense = sparse.todense().astype(np.int32)"

    opened by alamsaqib 8
  • some question about the structure

    some question about the structure

    I am a newer to graph neural network, I have read the paper and code, But I have a question, as we can see in the model code, self.W = nn.Linear(nfeat, nclass), that's the SGC model, why I think It's just a Bp neural network, it confuse me a lot.

    opened by LinzzMichael 6
  • confusion about the network structure

    confusion about the network structure

    hello,I have run your code and it's dramatically faster than other GCN framework.
    But could you tell me why your hidden unit is set to 0 and I try to change it,but it make no difference to the test precision.
    Thanks!
    
    opened by hl4080 5
  • About https://drive.google.com/drive/u/2/my-drive

    About https://drive.google.com/drive/u/2/my-drive

    When I clicked on this link, I entered my own network disk. I can not find the preprocessed version of the data. I do not know what is wrong. I hope you could help me. Thank you very much

    opened by youngflyasd 4
  • eye of adjacency matrix is added twice

    eye of adjacency matrix is added twice

    1. load_reddit_data() in utils.py - adj = adj + adj.T + sp.eye(adj.shape[0])
    2. aug_normalized_adjacency(adj) in normalization.py - adj = adj + sp.eye(adj.shape[0]) In load_reddit_data() from utils.py, after calling adj_normalizer(), eye of adj is added to adj twice.
    opened by zfnWong 3
  • Confusion on the reddit dataset

    Confusion on the reddit dataset

    Hi! I'm very interested in your work. When I run code on reddit datasets,I encountered this errors. adj = adj.cuda() RuntimeError: torch.cuda.sparse.FloatTensor is not enabled.

    opened by tonyandsunny 3
  • Efficiency Analysis of SGC

    Efficiency Analysis of SGC

    I found the training time improvements of SGC vary on different datasets. For example, SGC was trained 28 times faster than GCN on Pubmed dataset, while it is only < 5 times faster than GCN on TWITTER-WORLD, Cora and Citeseer. I wonder what the reason is to come out these kinds of results. Is there a theoretical guarantee? Or only the empirical results?

    The other question is how we can quantitatively analyze the training time of these GCNs? Are there any approaches to do this? I think it is not enough if only analyze the time complexity of matrix multiplication during forward/backward propagation with ignoring the time consuming of non-linear transformation.

    I would appreciate your help if you could provide the answers/insights of the above questions.

    opened by liu-jc 3
  • Memory Error For TWITTER-US Dataset

    Memory Error For TWITTER-US Dataset

    Hi, Tiiiger

    I am very interesting in your recent SGC work.

    I want to apply your SGC code to the Semi-supervised user geolocation which belongs to Downstream Tasks in your paper.

    The GEOTEXT dataset is OK, but when I turn to TWITTER-US and TWITTER-WORLD, it crashed.The error is list as follows:

    File "/home/wtl/桌面/wtlCode/geoSGC/dataProcess.py", line 96, in process_data features = torch.FloatTensor(features.to_dense()) RuntimeError: $ Torch: not enough memory: you tried to allocate 417GB. Buy new RAM! at /pytorch/aten/src/TH/THGeneral.cpp:201

    I have tried different versions of python and torch, such as python 2.7 + torch 1.0.1.post2 and python 3.5 + torch 1.0.1.post2 , but failed. I also google for solution but so many methods dose not work.

    Do you have the similar error, and how do you fix it? My computer is Ubuntu 16.04 with 40GB memory.

    Many thanks for your help.

    -Morton

    opened by MortonWang 3
  • AttributeError: 'tqdm' object has no attribute 'pos'

    AttributeError: 'tqdm' object has no attribute 'pos'

    When I tried to run tuning.py, I got an error. How can I fix this? Could you specify which version of hyperopt you used?

    Traceback (most recent call last): File "tuning.py", line 33, in best = fmin(sgc_objective, space=space, algo=tpe.suggest, max_evals=60) File "/Users/liujc/anaconda3/lib/python3.6/site-packages/hyperopt/fmin.py", line 407, in fmin rval.exhaust() File "/Users/liujc/anaconda3/lib/python3.6/site-packages/hyperopt/fmin.py", line 262, in exhaust self.run(self.max_evals - n_done, block_until_done=self.asynchronous) File "/Users/liujc/anaconda3/lib/python3.6/site-packages/hyperopt/fmin.py", line 198, in run disable=not self.show_progressbar, dynamic_ncols=True, File "/Users/liujc/anaconda3/lib/python3.6/site-packages/tqdm/_tqdm.py", line 850, in init self.set_postfix(refresh=False, **postfix) TypeError: set_postfix() argument after ** must be a mapping, not str Exception ignored in: <object repr() failed> Traceback (most recent call last): File "/Users/liujc/anaconda3/lib/python3.6/site-packages/tqdm/_tqdm.py", line 893, in del self.close() File "/Users/liujc/anaconda3/lib/python3.6/site-packages/tqdm/_tqdm.py", line 1111, in close pos = self.pos AttributeError: 'tqdm' object has no attribute 'pos'

    opened by liu-jc 3
  • Hi! Have you ever tested SGC on PPI dataset?

    Hi! Have you ever tested SGC on PPI dataset?

    I re-implemented SGC with pytorch-geometric and test on PPI while I got only 0.45-0.5 of micro-F1 score. I wonder whether my code has something wrong or SGC is not worked on PPI?

    opened by Panxuran 2
Owner
Tianyi
Tianyi
Official PyTorch implementation for paper Context Matters: Graph-based Self-supervised Representation Learning for Medical Images

Context Matters: Graph-based Self-supervised Representation Learning for Medical Images Official PyTorch implementation for paper Context Matters: Gra

null 49 Nov 23, 2022
Official implementation of the ICLR 2021 paper

You Only Need Adversarial Supervision for Semantic Image Synthesis Official PyTorch implementation of the ICLR 2021 paper "You Only Need Adversarial S

Bosch Research 272 Dec 28, 2022
Official implementation of the paper Image Generators with Conditionally-Independent Pixel Synthesis https://arxiv.org/abs/2011.13775

CIPS -- Official Pytorch Implementation of the paper Image Generators with Conditionally-Independent Pixel Synthesis Requirements pip install -r requi

Multimodal Lab @ Samsung AI Center Moscow 201 Dec 21, 2022
Official pytorch implementation of paper "Image-to-image Translation via Hierarchical Style Disentanglement".

HiSD: Image-to-image Translation via Hierarchical Style Disentanglement Official pytorch implementation of paper "Image-to-image Translation

null 364 Dec 14, 2022
Official pytorch implementation of paper "Inception Convolution with Efficient Dilation Search" (CVPR 2021 Oral).

IC-Conv This repository is an official implementation of the paper Inception Convolution with Efficient Dilation Search. Getting Started Download Imag

Jie Liu 111 Dec 31, 2022
Official implementation of our paper "LLA: Loss-aware Label Assignment for Dense Pedestrian Detection" in Pytorch.

LLA: Loss-aware Label Assignment for Dense Pedestrian Detection This project provides an implementation for "LLA: Loss-aware Label Assignment for Dens

null 35 Dec 6, 2022
This project is the official implementation of our accepted ICLR 2021 paper BiPointNet: Binary Neural Network for Point Clouds.

BiPointNet: Binary Neural Network for Point Clouds Created by Haotong Qin, Zhongang Cai, Mingyuan Zhang, Yifu Ding, Haiyu Zhao, Shuai Yi, Xianglong Li

Haotong Qin 59 Dec 17, 2022
Official implementation of our CVPR2021 paper "OTA: Optimal Transport Assignment for Object Detection" in Pytorch.

OTA: Optimal Transport Assignment for Object Detection This project provides an implementation for our CVPR2021 paper "OTA: Optimal Transport Assignme

null 217 Jan 3, 2023
This is the official PyTorch implementation of the paper "TransFG: A Transformer Architecture for Fine-grained Recognition" (Ju He, Jie-Neng Chen, Shuai Liu, Adam Kortylewski, Cheng Yang, Yutong Bai, Changhu Wang, Alan Yuille).

TransFG: A Transformer Architecture for Fine-grained Recognition Official PyTorch code for the paper: TransFG: A Transformer Architecture for Fine-gra

Ju He 307 Jan 3, 2023
Official implementation for NIPS'17 paper: PredRNN: Recurrent Neural Networks for Predictive Learning Using Spatiotemporal LSTMs.

PredRNN: A Recurrent Neural Network for Spatiotemporal Predictive Learning The predictive learning of spatiotemporal sequences aims to generate future

THUML: Machine Learning Group @ THSS 243 Dec 26, 2022
[PyTorch] Official implementation of CVPR2021 paper "PointDSC: Robust Point Cloud Registration using Deep Spatial Consistency". https://arxiv.org/abs/2103.05465

PointDSC repository PyTorch implementation of PointDSC for CVPR'2021 paper "PointDSC: Robust Point Cloud Registration using Deep Spatial Consistency",

null 153 Dec 14, 2022
This is an official implementation of our CVPR 2021 paper "Bottom-Up Human Pose Estimation Via Disentangled Keypoint Regression" (https://arxiv.org/abs/2104.02300)

Bottom-Up Human Pose Estimation Via Disentangled Keypoint Regression Introduction In this paper, we are interested in the bottom-up paradigm of estima

HRNet 367 Dec 27, 2022
The official pytorch implementation of our paper "Is Space-Time Attention All You Need for Video Understanding?"

TimeSformer This is an official pytorch implementation of Is Space-Time Attention All You Need for Video Understanding?. In this repository, we provid

Facebook Research 1k Dec 31, 2022
PixelPick This is an official implementation of the paper "All you need are a few pixels: semantic segmentation with PixelPick."

PixelPick This is an official implementation of the paper "All you need are a few pixels: semantic segmentation with PixelPick." [Project page] [Paper

Gyungin Shin 59 Sep 25, 2022
Official implementation of GraphMask as presented in our paper Interpreting Graph Neural Networks for NLP With Differentiable Edge Masking.

GraphMask This repository contains an implementation of GraphMask, the interpretability technique for graph neural networks presented in our ICLR 2021

Michael Schlichtkrull 29 Sep 2, 2022
The official implementation of our CVPR 2021 paper - Hybrid Rotation Averaging: A Fast and Robust Rotation Averaging Approach

Graph Optimizer This repo contains the official implementation of our CVPR 2021 paper - Hybrid Rotation Averaging: A Fast and Robust Rotation Averagin

Chenyu 109 Dec 23, 2022
Official Pytorch Implementation of: "ImageNet-21K Pretraining for the Masses"(2021) paper

ImageNet-21K Pretraining for the Masses Paper | Pretrained models Official PyTorch Implementation Tal Ridnik, Emanuel Ben-Baruch, Asaf Noy, Lihi Zelni

null 574 Jan 2, 2023
The official PyTorch implementation of the paper: *Xili Dai, Xiaojun Yuan, Haigang Gong, Yi Ma. "Fully Convolutional Line Parsing." *.

F-Clip — Fully Convolutional Line Parsing This repository contains the official PyTorch implementation of the paper: *Xili Dai, Xiaojun Yuan, Haigang

Xili Dai 115 Dec 28, 2022
The repository offers the official implementation of our paper in PyTorch.

Cloth Interactive Transformer (CIT) Cloth Interactive Transformer for Virtual Try-On Bin Ren1, Hao Tang1, Fanyang Meng2, Runwei Ding3, Ling Shao4, Phi

Bingoren 49 Dec 1, 2022