Unifying Temporal Graph (UTG) comparison between Continuous Time Dynamic Graphs and Discrete Time Dynamic Graphs (merged from UTG_dis, 3/4/2024)
- install torch
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
- install PyG
pip install torch_geometric==2.4.0
pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.2.0+cu121.html
- install TGX dependencies
see the instruction here
- install wandb
pip install wandb
git fetch origin
git checkout -b [branch] origin/[branch]
- DTDG Datasets (to compare CTDG with DTDG)
a. find a discretization level that has no time gap (no empty snapshots in between)
b. generate the negative samples for val and test with `data_script.main_dtdg_gen_ns.py`
c. run experiments with any script starting with `dtdg_` in the root
- TGB Datasets (to compare CTDG with DTDG)
a. always continuous and negative samples are downloaded from TGB
b. run experiments with any script starting with `ctdg_` in the root.
- run CTDG methods with discrete edge timestamps (training edges only)
a. generate the discrete timestamps with `data_script.discretize_ctdg_edges.py` will save as `.ts` files
b. load the `.ts` files to remap edge timestamps during training, see `tgn_dtdg_training.py`
c. evaluation is same as TGB
use --wandb to turn of tracking with wandb
- TGN commands
python dtdg_tgn.py -d canparl -t biyearly --lr 0.001 --max_epoch 500 --seed 1 --num_runs 5 --patience 100
python dtdg_tgn.py -d enron -t monthly --lr 0.001 --max_epoch 500 --seed 1 --num_runs 5 --patience 100
python dtdg_tgn.py -d uci -t weekly --lr 0.001 --max_epoch 500 --seed 1 --num_runs 5 --patience 100
python dtdg_tgn.py -d mooc -t daily --lr 0.001 --max_epoch 500 --seed 1 --num_runs 5 --patience 100
python dtdg_tgn.py -d social_evo -t daily --lr 0.001 --max_epoch 500 --seed 1 --num_runs 5 --patience 100
python dtdg_tgn.py -d contacts -t hourly --lr 0.0001 --max_epoch 200 --seed 1 --num_runs 5 --patience 50
- HTGN commands
python dtdg_main_htgn.py --model=HTGN --dataset=canparl -t biyearly --lr 0.001 --max_epoch 500 --num_runs 5 --patience 100
python dtdg_main_htgn.py --model=HTGN --dataset=enron -t monthly --lr 0.001 --max_epoch 500 --num_runs 5 --patience 100
python dtdg_main_htgn.py --model=HTGN --dataset=uci -t weekly --lr 0.001 --max_epoch 500 --num_runs 5 --patience 100
python dtdg_main_htgn.py --model=HTGN --dataset mooc -t daily --lr 0.001 --max_epoch 500 --num_runs 5 --patience 100
python dtdg_main_htgn.py --model=HTGN --dataset social_evo -t daily --lr 0.001 --max_epoch 500 --num_runs 5 --patience 100
python dtdg_main_htgn.py --model=HTGN --dataset contacts -t hourly --lr 0.001 --max_epoch 200 --num_runs 5 --patience 50
- EdgeBank Commands
python dtdg_edgebank.py -d enron -t monthly --mem_mode unlimited
python dtdg_edgebank.py -d enron -t monthly --mem_mode fixed_time_window
- GCLSTM Commands
python dtdg_gclstm.py --dataset=enron -t monthly --lr 0.001 --max_epoch 500 --num_runs 5 --patience 100
python dtdg_gclstm.py --dataset=uci -t weekly --lr 0.001 --max_epoch 500 --num_runs 5 --patience 100
python dtdg_gclstm.py --dataset mooc -t daily --lr 0.001 --max_epoch 500 --num_runs 5 --patience 100
python dtdg_gclstm.py --dataset social_evo -t daily --lr 0.001 --max_epoch 500 --num_runs 5 --patience 100
python dtdg_gclstm.py --dataset contacts -t hourly --lr 0.001 --max_epoch 200 --num_runs 5 --patience 50
python dtdg_gclstm.py --dataset=canparl -t biyearly --lr 0.001 --max_epoch 500 --num_runs 5 --patience 100
EGCNO Commands
python dtdg_egcno.py --dataset=enron -t monthly --lr 2e-4 --max_epoch 500 --num_runs 5 --patience 100
python dtdg_egcno.py --dataset=uci -t weekly --lr 2e-4 --max_epoch 500 --num_runs 5 --patience 100
python dtdg_egcno.py --dataset mooc -t daily --lr 2e-4 --max_epoch 500 --num_runs 5 --patience 100
python dtdg_egcno.py --dataset social_evo -t daily --lr 2e-4 --max_epoch 500 --num_runs 5 --patience 100
python dtdg_egcno.py --dataset contacts -t hourly --lr 2e-4 --max_epoch 200 --num_runs 5 --patience 50
python dtdg_egcno.py --dataset=canparl -t biyearly --lr 2e-4 --max_epoch 500 --num_runs 5 --patience 100
- basic GCN encoder and MLP decoder with test update
python dtdg_utg_gcn.py --dataset=enron -t monthly --lr 2e-4 --max_epoch 500 --num_runs 5 --patience 100
python ctdg_utg_gcn.py --dataset=tgbl-wiki -t hourly --lr 2e-4 --max_epoch 500 --seed 1 --num_runs 5 --patience 50 --batch_size 200
python ctdg_utg_gcn.py --dataset=tgbl-review -t monthly --lr 2e-4 --max_epoch 200 --seed 1 --num_runs 5 --patience 20 --batch_size 1000
- CTDG commands for dt datasets
python ctdg_egcno.py --dataset=tgbl-wiki -t hourly --lr 2e-4 --max_epoch 500 --seed 1 --num_runs 5 --patience 50 --batch_size 200
python ctdg_egcno.py --dataset=tgbl-review -t monthly --lr 2e-4 --max_epoch 200 --seed 1 --num_runs 5 --patience 20 --batch_size 200
python ctdg_gslstm.py --dataset=tgbl-wiki -t hourly --lr 2e-4 --max_epoch 500 --seed 1 --num_runs 5 --patience 50 --batch_size 200
python ctdg_gclstm.py --dataset=tgbl-review -t monthly --lr 2e-4 --max_epoch 200 --seed 1 --num_runs 5 --patience 20 --batch_size 200
use --wandb to turn on tracking with wandb
python ctdg_main_htgn.py --model=HTGN --dataset=tgbl-wiki -t hourly --lr 0.001 --max_epoch 200 --num_runs 5 --patience 50
python ctdg_main_htgn.py --model=HTGN --dataset=tgbl-review -t monthly --lr 0.001 --max_epoch 200 --num_runs 5 --patience 50
python ctdg_main_htgn.py --model=HTGN --dataset=tgbl-coin -t hourly --lr 0.001 --max_epoch 200 --num_runs 5 --patience 50
python main_dtdg_gen_ns.py -d uci -t weekly
python main_dtdg_gen_ns.py -d enron -t monthly
python main_dtdg_gen_ns.py -d mooc -t daily
python main_dtdg_gen_ns.py -d social_evo -t daily
required dependencies for normal environment
- install TGB and TGX locally, clone the repo respectively and
pip install -e .
- install torch, PyG and other dependencies
pip install torch==1.13.1
pip install torch-geometric==2.3.1
pip install torch-scatter==2.1.1
pip install geoopt
pip install -r requirements.txt
for compute canada, use:
pip install -r requirements_ccai.txt
-
convert CTDG edgelist into DTDG edgelist (for the training set)
-
store the converted DTDG edgelist (with converted UNIX timestamps)
-
load the DTDG training set with TGB framework (or construct separate data loading / data class)
-
train TGN on DTDG training set
-
use the TGB class for evaluation set (the test edges) and evaluation