/GAP

Implementation of GAP: Graph Neighborhood Attentive Pooling, https://arxiv.org/abs/2001.10394. A context-sensitve graph (network) representation learning algorithm that relies only on the structure of the graph.

Primary LanguagePython

GAP

Implementation of GAP: Graph Neighborhood Attentive Pooling, https://arxiv.org/abs/2001.10394. A context-sensitve graph (network) representation learning algorithm that relies only on the structure of the graph.

Update!

The improved version published in the International AAAI Conference on Web and Social Media, 2020 (ICWSM'20) is available here. The code base is improved for readability, documentation and includes support for 12 datasets.

Requirements!

  • Python 3.6+
  • PyTorch 1.3.1+
  • Numpy 1.17.2+
  • Networkx 2.3+

Optional Requirment

for evaluating node-clustering performance of algorithms

  • scikit-learn 0.21.3+

Usage

Example usage

$ cd src
$ python gap.py

OR

$ bash run.sh

Input Arguments

--input: A path to a graph file. Default is ../data/cora/graph.txt

--fmt: The format of the input graph, either edgelist or adjlist. Default is edgelist

--output-dir: A path to a directory to save intermediate and final outputs of GAP. Default is ../data/cora/outputs

--dim: The size (dimension) of nodes' embedding (representation) vector. Default is 200.

--epochs: The number of epochs. Default is 100.

--tr-rate: Training rate, i.e. the fraction of edges to be used as a training set. A value in (0, 1]. Default is .15. The remaining fraction of edges (1 - tr_rate), test edges, will be saved in the directory specified by --ouput-dir argument.

--dev-rate: Development rate, i.e. the fraction of the training set to be used as a development (validation) set. A value in [0, 1). Default is 0.2.

--learning-rate: Learning rate, a value in [0, 1]. Default is 0.0001

--dropout-rate: Dropout rate, a value in [0, 1]. Deafult is 0.5

--nbr-size: The number of neighbors to be sampled. Default is 100.

--directed: Whether the graph is directed or not. 1 for directed and 0 for undirected. Default is 1.

--verbose:. Whether to turn on a verbose logger or not. 1 is on and 0 is off. Default is 1.

Some Results

An excerpt of the reported results for link-prediction on the cora dataset.

Algorithm Training ratio
0.15 0.35 0.55 0.75
DeepWalk 56.0 70.2 80.1 85.3
Node2Vec 55.0 66.4 77.6 85.6
AttentiveWalk 64.2 81.0 87.1 92.4
TriDnr 85.9 90.5 91.3 93.0
CENE 72.1 84.6 89.4 93.9
CANE 86.8 92.2 94.6 95.6
DMTE 91.3 93.7 96.0 97.4
SPLITTER 65.4 73.7 80.1 83.9
GAP 95.8 97.1 97.6 97.8

Citing

@misc{kefato2020graph,
    title={Graph Neighborhood Attentive Pooling},
    author={Zekarias T. Kefato and Sarunas Girdzijauskas},
    year={2020},
    eprint={2001.10394},
    archivePrefix={arXiv},
    primaryClass={cs.LG}
}