README.md 3.15 KB
Newer Older
kitaev-chen's avatar
kitaev-chen committed
1
2
3
4
5
6
7
8
Graph Isomorphism Network (GIN)
============

- Paper link: [arXiv](https://arxiv.org/abs/1810.00826) [OpenReview](https://openreview.net/forum?id=ryGs6iA5Km) 
- Author's code repo: [https://github.com/weihua916/powerful-gnns](https://github.com/weihua916/powerful-gnns).

Dependencies
------------
Mufei Li's avatar
Mufei Li committed
9
- PyTorch 1.1.0+
kitaev-chen's avatar
kitaev-chen committed
10
11
12
13
14
15
16
17
18
19
20
21
22
- sklearn
- tqdm

``bash
pip install torch sklearn tqdm
``

How to run
----------

An experiment on the GIN in default settings can be run with

```bash
VoVAllen's avatar
VoVAllen committed
23
python main.py
kitaev-chen's avatar
kitaev-chen committed
24
25
26
27
```

An experiment on the GIN in customized settings can be run with
```bash
VoVAllen's avatar
VoVAllen committed
28
python main.py [--device 0 | --disable-cuda] --dataset COLLAB \
kitaev-chen's avatar
kitaev-chen committed
29
30
               --graph_pooling_type max --neighbor_pooling_type sum
```
31
add `--degree_as_nlabel` to use one-hot encodings of node degrees as node feature vectors
kitaev-chen's avatar
kitaev-chen committed
32
33
34
35

Results
-------

36
37
results may **fluctuate**, due to random factors and the relatively small data set. if you want to follow the paper's setting, consider the script below.

kitaev-chen's avatar
kitaev-chen committed
38
```bash
39
# 4 bioinformatics datasets setting graph_pooling_type=sum, the nodes have categorical input features 
VoVAllen's avatar
VoVAllen committed
40
python main.py --dataset MUTAG --device 0  \
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
                --graph_pooling_type sum --neighbor_pooling_type sum --filename MUTAG.txt

python main.py --dataset PTC --device 0  \
                --graph_pooling_type sum --neighbor_pooling_type sum --filename PTC.txt

python main.py --dataset NCI1 --device 0  \
                --graph_pooling_type sum --neighbor_pooling_type sum --filename NCI1.txt

python main.py --dataset PROTEINS --device 0  \
                --graph_pooling_type sum --neighbor_pooling_type sum --filename PROTEINS.txt

# 5 social network datasets setting graph_pooling_type=mean, for the REDDIT datasets, we set all node feature vectors to be the same 
# (thus, features here are uninformative); for the other social networks, we use one-hot encodings of node degrees.  
python main.py --dataset COLLAB --device 0  \
                --graph_pooling_type mean --neighbor_pooling_type sum --degree_as_nlabel --filename COLLAB.txt

python main.py --dataset IMDBBINARY --device 0  \
                --graph_pooling_type mean --neighbor_pooling_type sum --degree_as_nlabel --filename IMDBBINARY.txt

python main.py --dataset IMDBMULTI --device 0  \
                --graph_pooling_type mean --neighbor_pooling_type sum --degree_as_nlabel --filename IMDBMULTI.txt

python main.py --dataset REDDITBINARY --device 0  \
                --graph_pooling_type mean --neighbor_pooling_type sum --filename REDDITBINARY.txt --fold_idx 6 --epoch 120

python main.py --dataset REDDITMULTI5K --device 0  \
                --graph_pooling_type mean --neighbor_pooling_type sum --filename REDDITMULTI5K.txt
kitaev-chen's avatar
kitaev-chen committed
68
69
```

70
71
72
73
74
75
76
77
78
79
80
81
82
83
one fold of 10 result are below.

| dataset       | our result | paper report |
| ------------- | ---------- | ------------ |
| MUTAG         | 89.4      | 89.4 ± 5.6   |
| PTC           | 68.5      | 64.6 ± 7.0   |
| NCI1          | 78.5      | 82.7 ± 1.7   |
| PROTEINS      | 72.3      | 76.2 ± 2.8   |
| COLLAB        | 81.6      | 80.2 ± 1.9   |
| IMDBBINARY    | 73.0      | 75.1 ± 5.1   |
| IMDBMULTI     | 54.0      | 52.3 ± 2.8   |
| REDDITBINARY  | 88.0      | 92.4 ± 2.5   |
| REDDITMULTI5K | 54.8      | 57.5 ± 1.5   |