项目文件夹

文件
Chen Sirui d04d59eef9 [Example] Temporal Graph Neural Network (#2636)
* Add hgat example

* Add experiment

* Clean code

* clear the code

* Add index in README

* Add index in README

* Add index in README

* Add index in README

* Add index in README

* Add index in README

* Change the code title and folder name

* Ready to merge

* Prepare for rebase and change message passing function

* use git ignore to handle empty file

* change file permission to resolve empty file

* Change permission

* change file mode

* Finish Coding

* working code cpu

* pyg compare

* Accelerate with batching

* FastMode Enabled

* update readme

* Update README.md

* refractor code

* Fix Bug

* add a simple temporal sampling method

* test results

* add train speed result

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* fix bug

* Fixed Grammar and Format Issue

Co-authored-by: Chen <chesirui@3c22fbe5458c.ant.amazon.com>
Co-authored-by: Tianjun Xiao <xiaotj1990327@gmail.com>
Co-authored-by: Ubuntu <ubuntu@ip-172-31-4-63.ap-northeast-1.compute.internal>
Co-authored-by: WangXuhongCN <wangxuhongcn@163.com>
Co-authored-by: WangXuhongCN <34096632+WangXuhongCN@users.noreply.github.com>
2021-03-23 08:57:21 +08:00
..

Temporal Graph Neural Network (TGN)

DGL Implementation of tgn paper.

This DGL examples implements the GNN mode proposed in the paper TemporalGraphNeuralNetwork

TGN implementor

This example was implemented by Ericcsr during his SDE internship at the AWS Shanghai AI Lab.

Graph Dataset

Jodie Wikipedia Temporal dataset. Dataset summary:

  • Num Nodes: 9227
  • Num Edges: 157, 474
  • Num Edge Features: 172
  • Edge Feature type: LIWC
  • Time Span: 30 days
  • Chronological Split: Train: 70% Valid: 15% Test: 15%

Jodie Reddit Temporal dataset. Dataset summary:

  • Num Nodes: 11,000
  • Num Edges: 672, 447
  • Num Edge Features: 172
  • Edge Feature type: LIWC
  • Time Span: 30 days
  • Chronological Split: Train: 70% Valid: 15% Test: 15%

How to run example files

In tgn folder, run

please use train.py

python train.py --dataset wikipedia

If you want to run in fast mode:

python train.py --dataset wikipedia --fast_mode

If you want to run in simple mode:

python train.py --dataset wikipedia --simple_mode

If you want to change memory updating module:

python train.py --dataset wikipedia --memory_updater [rnn/gru]

Performance

Without New Node in test set

Models/Datasets Wikipedia Reddit
TGN simple mode AP: 98.5 AUC: 98.9 AP: N/A AUC: N/A
TGN fast mode AP: 98.2 AUC: 98.6 AP: N/A AUC: N/A
TGN AP: 98.9 AUC: 98.5 AP: N/A AUC: N/A

With New Node in test set

Models/Datasets Wikipedia Reddit
TGN simple mode AP: 98.2 AUC: 98.6 AP: N/A AUC: N/A
TGN fast mode AP: 98.0 AUC: 98.4 AP: N/A AUC: N/A
TGN AP: 98.2 AUC: 98.1 AP: N/A AUC: N/A

Training Speed / Batch

Intel E5 2cores, Tesla K80, Wikipedia Dataset

Models/Datasets Wikipedia Reddit
TGN simple mode 0.3s N/A
TGN fast mode 0.28s N/A
TGN 1.3s N/A

Details explained

What is Simple Mode

Simple Temporal Sampler just choose the edges that happen before the current timestamp and build the subgraph of the corresponding nodes. And then the simple sampler uses the static graph neighborhood sampling methods.

What is Fast Mode

Normally temporal encoding needs each node to use incoming time frame as current time which might lead to two nodes have multiple interactions within the same batch need to maintain multiple embedding features which slow down the batching process to avoid feature duplication, fast mode enables fast batching since it uses last memory update time in the last batch as temporal encoding benchmark for each node. Also within each batch, all interaction between two nodes are predicted using the same set of embedding feature

What is New Node test

To test the model has the ability to predict link between unseen nodes based on neighboring information of seen nodes. This model deliberately select 10 % of node in test graph and mask them out during the training