Skip to content

scylj1/GNN_Edge_Regression

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Can GNNs Perform Temporal Edge Regression Tasks? A Case Study on Agricultural Trade Between Nations

Set up

  1. Create python environment, e.g., conda create -n dgb python=3.9

  2. Run source install.sh

Run regression

You can find all scripts in run.sh

The basic scripts for dynamic GNN is as follows:

data=UNtrade
n_runs=1

# TGN
method=tgn
prefix="${method}_attn"
python tgn/train_self_supervised.py -d $data --use_memory --prefix "$prefix" --n_runs "$n_runs" --gpu 0

# JODIE
method=jodie
prefix="${method}_rnn"
python tgn/train_tgn_regression.py -d $data --use_memory --memory_updater rnn --embedding_module time --prefix "$prefix" --n_runs "$n_runs" --gpu 0

# DyRep
method=dyrep
prefix="${method}_rnn"
python tgn/train_tgn_regression.py -d "$data" --use_memory --memory_updater rnn --dyrep --use_destination_embedding_in_message --prefix "$prefix" --n_runs "$n_runs" --gpu 0

The following normalization methods are available:

# Just choose one of them is fine!

--max_normalization

--logarithmize_weights

--node_out_normalization

(--node_in_normalization)

If do NOT want to use negative sampler:

--no_negative_sampling

If you want to train on all edges, use the following together:

--no_negative_sampling --fill_all_edges 

If want to run baselines

--do_baseline

To run static GNN:

python gcn/train_gcn_regression.py -d "UNtrade"

and don't forget to add a normalization method.

Run classification

data=UNtrade
n_runs=1

#baseline 
python tgn/train_tgn_classification.py -d $data --use_memory --prefix "$prefix" --n_runs 1 --gpu 0 --n_epoch 1 --num_class 10 --do_baseline

# TGN
method=tgn
prefix="${method}_attn"
python tgn/train_tgn_classification.py -d $data --use_memory --prefix "$prefix" --n_runs "$n_runs" --gpu 0 --n_epoch 200 --num_class 10 

# Jodie
method=jodie
prefix="${method}_rnn"
python tgn/train_tgn_classification.py -d $data --use_memory --memory_updater rnn --embedding_module time --prefix "$prefix" --n_runs "$n_runs" --gpu 0 --n_epoch 200 --num_class 10

#Dyrep
method=dyrep
prefix="${method}_rnn"
python tgn/train_tgn_classification.py -d "$data" --use_memory --memory_updater rnn --dyrep --use_destination_embedding_in_message --prefix "$prefix" --n_runs "$n_runs" --gpu 0 --n_epoch 200 --num_class 10

If do NOT want to use negative sampler:

--no_negative_sampling

Acknowledgement

We would like to thank our supervisors Shenyang (Andy) Huang and Dr.Farimah Poursafaei for their kindly supports and the course lecturers Dr.Petar Veličković and Dr.Pietro Liò for their great teaching. We also thank the authors for providing the code access to DGB and TGN.

About

Graph Neural Networks (GNNs) for Temporal Edge Regression Tasks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •