Giter Club home page Giter Club logo

hc-gnn's Introduction

Hierarchical Message-Passing Graph Neural Networks

Code of the first practical model (HC-GNN).

Required packages

The code has been tested running under Python 3.7.3. with the following packages installed (along with their dependencies):

  • numpy == 1.16.5
  • pandas == 0.25.1
  • scikit-learn == 0.21.2
  • networkx == 2.3
  • community (python-louvain) == 0.13
  • pytorch == 1.1.0
  • torch_geometric == 1.3.2

Data requirement

All eight datasets we used in the paper are all public datasets which can be downloaded from the internet.

Code execution

Link prediction:

python main.py --task LP --dataset grid --mode basemodel --model HCGNN --layer_num 3 --epoch_num 2001 --lr 0.0001 --relu True --dropout True --drop_ratio 0.5 --same_level_gnn GCN --down2up_gnn MEAN --up2down_gnn GAT --fshot False --SEED 123 --gpu True

Node classification and community detection:

python main.py --task NC --dataset cora --mode basemodel --model HCGNN --layer_num 2 --epoch_num 201 --lr 0.01 --relu True --dropout False --drop_ratio 0.5 --same_level_gnn GCN --down2up_gnn MEAN --up2down_gnn GCN --fshot True --SEED 1234 --gpu True

Model hyper-parameters:

--task: the target downstream task, "LP; NC; Inductive", type=str, default=LP 
--dataset: dataset name, type=str, default=grid 
--mode: the experiment type, type=str, default=basemodel 
--model: the model name, type=str, default=HCGNN 
--layer_num: the number of layers of primary GNN encoder for within level propagation, type=int, default=3 
--epoch_num: epoch number, type=int, default=2001 
--lr: learning rate, type=float, default=0.0001 
--relu: whether use relu as activation function in the model, type=bool, default=True 
--dropout: whether use dropout component in the model, type=bool, default=True 
--drop_ratio: dropout ratio if use dropout component, type=float, default=0.5 
--same_level_gnn: the GNN encoder for within level propagation, type=str, default=GCN 
--down2up_gnn: define the down2up propagation, type=str, default=MEAN 
--up2down_gnn: define the top2down propagation, type=str, default=GAT 
--fshot: if adopt few-shot learning settings, type=bool, default=False 
--SEED: random seed, type=int, default=123 
--gpu: if use GPU device, type=bool, default=True

Two demo file is given to show the execution of link prediction (LP) and node classification (NC) tasks.

Cite

Please cite our paper if it is helpful in your own work:

@article{ZLP23,
author = {Zhiqiang Zhong and Cheng{-}Te Li and Jun Pang},
title = {Hierarchical Message-Passing Graph Neural Networks},
journal = {Data Mining and Knowledge Discovery (DMKD)},
volume = {37},
number = {1},
pages = {381--408},
publisher = {Springer},
year = {2023},
}

hc-gnn's People

Contributors

zhiqiangzhongddu avatar

Stargazers

Honglin Shu avatar CL avatar Big Daddy Bobs avatar  avatar Jong Choi avatar Daniel-syx avatar Valentina Blasone avatar  avatar Flipped avatar  avatar Wobbuffet Millwood avatar  avatar Morgan Hough avatar Haoran MO avatar

Watchers

 avatar Kostas Georgiou avatar Elijah Danquah Darko avatar

hc-gnn's Issues

community

"Namespace(SEED=1234, comment='0', community_detection_method='Louvain', dataset='cora', device=device(type='cpu'), down2up_gnn='MEAN', drop_ratio=0.5, dropout=True, epoch_log=10, epoch_num=201, feature_pre=True, fshot=True, gpu=True
, layer_num=2, lr=0.01, mode='basemodel', model='HCGNN', ratio_sample_pos=20, relu=True, same_level_gnn='GCN', task='NC', threshold=1, up2down_gnn='GCN', use_features=True)

is reading cora dataset...
Name:
Type: Graph
Number of nodes: 2708
Number of edges: 5278
Average degree: 3.8981
is processing dataset...
is generating hierarchical structure....
Is doing community detection....
start 0 subgraph...
Traceback (most recent call last):
File "main.py", line 96, in
ls_hierarchical_community, ls_up2down_edges, ls_down2up_edges = hierarchical_structure_generation(
File "D:\data\Article\HC-GNN\community_detection.py", line 224, in hierarchical_structure_generation
ls_hierarchical_community = Louvain_community_detection(graphs=graphs)
File "D:\data\Article\HC-GNN\community_detection.py", line 18, in Louvain_community_detection
dendrogram_old = community.generate_dendrogram(G)
AttributeError: module 'community' has no attribute 'generate_dendrogram'"

May I ask if anyone has encountered this problem before?

dataset

I would like to excuse you and ask you some questions about the email data set. According to what is described in your open source model code, the email data set contains two files, one is email.txt and the other is the email_labels.txt file. I I can't find this type of email data set. Can you share with me the download link of the data set? thank you for your help!

datasets

May I ask why there are only processing operations for the four datasets in the code, and some other datasets mentioned in the experiment were not processed in the code? For example, pubmeb and PPI

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.