GithubHelp home page GithubHelp logo

blackhalo-drake / sagnn-substructure-aware-graph-neural-networks Goto Github PK

View Code? Open in Web Editor NEW
17.0 1.0 2.0 312 KB

Official implementation of SAGNN

License: GNU Lesser General Public License v2.1

Python 100.00%

sagnn-substructure-aware-graph-neural-networks's Introduction

SAGNN-Substructure-Aware-Graph-Neural-Networks

Official implementation of SAGNN for our AAAI 2023 paper: Substructure Aware Graph Neural Networks.

PWC

Setup

# params
# 4/1/2023, newest packages. 
ENV=sagnn
CUDA=11.1
TORCH=1.9.1
PYG=2.0.1

# create env 
conda create --name $ENV python=3.9 -y
conda activate $ENV

# install pytorch 
conda install pytorch=$TORCH torchvision torchaudio cudatoolkit=$cuda -c pytorch -c nvidia -y

# install pyg2.0
conda install pyg=$PYG -c pyg -c conda-forge -y

# install ogb 
pip install ogb

# install rdkit
conda install -c conda-forge rdkit -y

# update yacs and tensorboard
pip install yacs==0.1.8 --force  # PyG currently use 0.1.6 which doesn't support None argument. 
pip install tensorboard
pip install matplotlib

Run SAGNN on ZINC

Download ZINC dataset in https://drive.google.com/drive/folders/1TAoTiA4JndEfdFklJ7ESAibG0t8b8Lar?usp=share_link and put it in \data\ZINC

1. ZINC

Train in ZINC with GINEConv

python -m train.zinc model.gnn_type GINEConv 

Train in ZINC with SimplifiedPNAConv

python -m train.zinc model.gnn_type SimplifiedPNAConv 

You can run SAGNN on other datasets by converting the data to suitable format.

Test SAGNN on ZINC with GINEConv

Download pretrained neural network weights in https://drive.google.com/drive/folders/1ytwVuJW7RoYaiP4KfyPryebw5-Qt-qo7?usp=share_link and put it in \checkpoint\ZINC

  python -m train.test_zinc model.gnn_type GINEConv train.checkpoint_path ./checkpoint/ZINC/SAGNN_best_zinc.pt

Citation

Please kindly cite this paper if you use the code:

@inproceedings{zeng2023substructure,
title={Substructure aware graph neural networks},
author={Zeng, Dingyi and Liu, Wanlong and Chen, Wenyu and Zhou, Li and Zhang, Malu and Qu, Hong},
booktitle={Proc. of AAAI},
volume={37},
number={9},
pages={11129--11137},
year={2023}
}

sagnn-substructure-aware-graph-neural-networks's People

Contributors

blackhalo-drake avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

shmqaq vcanogil

sagnn-substructure-aware-graph-neural-networks's Issues

BUG

It's wonderful work.
I ran into a bug while reproducing the code, and I didn't find a solution for it. Anyone else has encountered this problem while reproducing the changed code or can the author help?

Traceback (most recent call last):
  File "/home/lugewei/anaconda3/envs/lgw/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/lugewei/anaconda3/envs/lgw/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/lugewei/.virtualenvs/untitled2/SAGNN/train/zinc.py", line 100, in <module>
    run(cfg, create_dataset, create_model, train, test)
  File "/home/lugewei/.virtualenvs/untitled2/SAGNN/core/train_helper.py", line 124, in run
    train_dataset, val_dataset, test_dataset = create_dataset(cfg)
  File "/home/lugewei/.virtualenvs/untitled2/SAGNN/train/zinc.py", line 37, in create_dataset
    calculate_stats(train_dataset)
  File "/home/lugewei/.virtualenvs/untitled2/SAGNN/core/utils.py", line 4, in calculate_stats
    ave_num_nodes = np.array([g.num_nodes for g in dataset]).mean()
  File "/home/lugewei/.virtualenvs/untitled2/SAGNN/core/utils.py", line 4, in <listcomp>
    ave_num_nodes = np.array([g.num_nodes for g in dataset]).mean()
AttributeError: 'collections.defaultdict' object has no attribute 'num_nodes'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.