ytchx1999 / dgl-lp-baseline

Link prediction gnn baselines implemented by DGL.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dgl-lp-baseline

Link prediction gnn baselines implemented by DGL.

Environment

dgl == 0.8.2
torch == 1.8.2
sklearn == 1.0.2
tqdm

Data

.
|-- processed_data
   |-- amazon
   |--|-- field_trans
   |--|--|-- ...
   |--|-- time_trans
   |--|--|-- ...
   |-- gowalla
   |--|-- field_trans
   |--|--|-- ...
   |--|-- time_trans
   |--|--|-- ml_gowalla_Entertainment_pretrain.csv
   |--|--|-- ml_gowalla_Entertainment_pretrain_node.npy
   |--|--|-- ml_gowalla_Entertainment_downstream.csv
   |--|--|-- ml_gowalla_Entertainment_downstream_node.npy
   |--|--|-- ...

Run

Take GraphSAGE as an example, other methods (GCN, GIN, GAT, DGI) have the same operations and just replace sage in scripts name.

Time transfer

cd scripts/time/
# amazon
# amazon_beauty
bash pretrain_amazon_beauty_time_sage.sh
bash downstream_amazon_beauty_time_sage.sh
# amazon_fashion
bash pretrain_amazon_fashion_time_sage.sh
bash downstream_amazon_fashion_time_sage.sh
# amazon_luxury
bash pretrain_amazon_luxury_time_sage.sh
bash downstream_amazon_luxury_time_sage.sh

# gowalla
# gowalla_Entertainment
bash pretrain_gowalla_entertainment_time_sage.sh
bash downstream_gowalla_entertainment_time_sage.sh
# gowalla_Food
bash pretrain_gowalla_food_time_sage.sh
bash downstream_gowalla_food_time_sage.sh
# gowalla_Shopping
bash pretrain_gowalla_shopping_time_sage.sh
bash downstream_gowalla_shopping_time_sage.sh

Field transfer

cd scripts/field/
# amazon
bash pretrain_amazon_acs_field_sage.sh
bash downstream_amazon_beauty_field_sage.sh
bash downstream_amazon_fashion_field_sage.sh
bash downstream_amazon_luxury_field_sage.sh

# gowalla
bash pretrain_gowalla_community_field_sage.sh
bash downstream_gowalla_entertainment_field_sage.sh
bash downstream_gowalla_food_field_sage.sh
bash downstream_gowalla_shopping_field_sage.sh

Time+Field transfer

cd scripts/time_field/
# amazon
bash pretrain_amazon_acs_time_field_sage.sh
bash downstream_amazon_beauty_time_field_sage.sh
bash downstream_amazon_fashion_time_field_sage.sh
bash downstream_amazon_luxury_time_field_sage.sh

# gowalla
bash pretrain_gowalla_community_time_field_sage.sh
bash downstream_gowalla_entertainment_time_field_sage.sh
bash downstream_gowalla_food_time_field_sage.sh
bash downstream_gowalla_shopping_time_field_sage.sh

Args

  -d, --data     Dataset name
  --bs           Batch_size
  --n_head       Number of heads used in attention layer
  --n_epoch      Number of epochs
  --lr           Learning rate
  --weight_decay weight decay
  --n_runs       Number of runs
  --gpu          Idx for the gpu to use
  --model        {graphsage,gat,gin} Type of embedding module
  --n_hidden     Dimensions of the hidden
  --fanout       Neighbor sampling fanout
  --data_type    Type of dataset
  --task_type    Type of task
  --mode         pretrain or downstream
  --seed         Seed for all

About

Link prediction gnn baselines implemented by DGL.

License:MIT License


Languages

Language:Python 75.4%Language:Shell 24.6%