Skip to content

Commit

Permalink
Added readme, requirements and license
Browse files Browse the repository at this point in the history
  • Loading branch information
gcorso committed Apr 10, 2020
1 parent 759f8f7 commit 57e4238
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 1 deletion.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Gabriele Corso, Luca Cavalleri

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Binary file added PNA_architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Principal Neighbourhood Aggregation

Principal Neighbourhood Aggregation for GNNs [https://arxiv.org/abs/XXX](https://arxiv.org/abs/XXX)

## Overview

We provide the implementation of the Principal Neighbourhood Aggregation (PNA) in PyTorch along with scripts to generate the multitask benchmarks, a flexible GNN framework and implementations of the other models used for comparison. The repository is organised as follows:
- `datasets_generation/` contains the scripts for the generation of the benchmarks
- `models/` contains:
- the implementation of the aggregators, the scalers and the PNA layer (`/pna/`)
- the flexible GNN framework that can be used with any type of graph convolutions (`gnn_framework.py`)
- implementations of the other GNN models used for comparison in the paper, namely GCN, GAT, GIN and MPNN
- `util/` contains
- preprocessing subroutines and loss functions (`util.py`)
- training and evaluation procedures (`train.py`)
- general NN layers used by the various models (`layers.py`)

## Dependencies
Install PyTorch from the [official website](https://pytorch.org/). The code was tested over PyTorch 1.4.

Then install the other dependencies:
```
pip install -r requirements.txt
```

## Test run

Generate the benchmark dataset (add `--extrapolation` for multiple test sets of different sizes):
```
python -m datasets_generation.multitask_dataset
```

then run the training, for example:
```
python -m models.pna.train --variable --fixed --gru --variable_conv_layers=N/2 --aggregators="mean max min std" --scalers="identity amplification attenuation" --data=data/multitask_dataset.pkl
```

The model specified by the arguments above uses the same architecture (represented in the image below) and the same aggregators and scalers as used for the results in the paper. Note that the default hyper-parameters are not the best performing for every model, refer to the paper for details on how we set them.

![Architecture](PNA_architecture.png)


## Reference
...

## License
MIT
2 changes: 1 addition & 1 deletion datasets_generation/multitask_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def save_as_pickle(self, filename):
parser.add_argument('--graph_labels', nargs='+', default=["is_connected", "diameter", "spectral_radius"])
parser.add_argument('--extrapolation', action='store_true', default=False,
help='Generated various test sets of dimensions larger than train and validation.')
parser.add_argument('--print_every', type=int, default=1, help='')
parser.add_argument('--print_every', type=int, default=20, help='')
args = parser.parse_args()

if 'sssp' in args.nodes_labels:
Expand Down
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
numpy
networkx
matplotlib
torch

0 comments on commit 57e4238

Please sign in to comment.