DrBC-pytorch
所属分类:图神经网络
开发工具:Jupyter Notebook
文件大小:47492KB
下载次数:0
上传日期:2023-03-28 16:19:28
上 传 者:
sh-1993
说明: 论文“从头开始学习识别高匹配度中心节点:一种新的图N...
(The implementation of paper named "Learning to Identify High Betweenness Centrality Nodes from Scratch: A Novel Graph Neural Network Approach" (CIKM 2019).)
文件列表:
.ipynb_checkpoints (0, 2023-03-29)
.ipynb_checkpoints\train-checkpoint.py (6645, 2023-03-29)
__pycache__ (0, 2023-03-29)
__pycache__\generator.cpython-39.pyc (3306, 2023-03-29)
__pycache__\model.cpython-39.pyc (3097, 2023-03-29)
__pycache__\utils.cpython-39.pyc (2070, 2023-03-29)
generator.py (6104, 2023-03-29)
hw1_data (0, 2023-03-29)
hw1_data\.DS_Store (6148, 2023-03-29)
hw1_data\Synthetic (0, 2023-03-29)
hw1_data\Synthetic\5000 (0, 2023-03-29)
hw1_data\Synthetic\5000\0.txt (174844, 2023-03-29)
hw1_data\Synthetic\5000\0_score.txt (135222, 2023-03-29)
hw1_data\Synthetic\5000\1.txt (175227, 2023-03-29)
hw1_data\Synthetic\5000\10.txt (174938, 2023-03-29)
hw1_data\Synthetic\5000\10_score.txt (135290, 2023-03-29)
hw1_data\Synthetic\5000\11.txt (174733, 2023-03-29)
hw1_data\Synthetic\5000\11_score.txt (135255, 2023-03-29)
hw1_data\Synthetic\5000\12.txt (174922, 2023-03-29)
hw1_data\Synthetic\5000\12_score.txt (135184, 2023-03-29)
hw1_data\Synthetic\5000\13.txt (174903, 2023-03-29)
hw1_data\Synthetic\5000\13_score.txt (135305, 2023-03-29)
hw1_data\Synthetic\5000\14.txt (174907, 2023-03-29)
hw1_data\Synthetic\5000\14_score.txt (135239, 2023-03-29)
hw1_data\Synthetic\5000\15.txt (175451, 2023-03-29)
hw1_data\Synthetic\5000\15_score.txt (135217, 2023-03-29)
hw1_data\Synthetic\5000\16.txt (175141, 2023-03-29)
hw1_data\Synthetic\5000\16_score.txt (135209, 2023-03-29)
hw1_data\Synthetic\5000\17.txt (174921, 2023-03-29)
hw1_data\Synthetic\5000\17_score.txt (135306, 2023-03-29)
hw1_data\Synthetic\5000\18.txt (175120, 2023-03-29)
hw1_data\Synthetic\5000\18_score.txt (135244, 2023-03-29)
hw1_data\Synthetic\5000\19.txt (174897, 2023-03-29)
hw1_data\Synthetic\5000\19_score.txt (135241, 2023-03-29)
hw1_data\Synthetic\5000\1_score.txt (135186, 2023-03-29)
hw1_data\Synthetic\5000\2.txt (174828, 2023-03-29)
hw1_data\Synthetic\5000\20.txt (174707, 2023-03-29)
... ...
# DrBC-pytorch
The implementation of paper named "Learning to Identify High Betweenness Centrality Nodes from Scratch: A Novel Graph Neural Network Approach" (CIKM 2019).
## Project structure
* **model.py**: the model structure of DrBC
* **utils.py**: the loss and metrics for DrBC training and testing
* **train.py**: define how to train the model DrBC
* **test.py**: given path of graph and ground truth, and then calculate the testing result
* **generator.py**: definition of dataset and how to get information from it, and it also contains the main function to generate the training data, which will store in **train_val_gen/**
* **test_30/**: it is a directory for generating the final testing synthetic data (nodes: 5000, 10000, 20000, 50000, 100000)
* **test.sh**: shell script for testing all TA's synthetic dataset
* **reproduce.ipynb**: notebook for reproducing the paper's tables and figures and some results will store in **reproduce/** directory
## How to use it
### generating your own data
```
python generator.py --batch_size 16 --train_size 10000 --eval_size 100 --scale 0 1 2 3 4
```
if you want to use the data I generated: click [here](https://drive.google.com/file/d/1Zb2HiBhDZVEtHFHrM4QipIlghBlWD1Cs/view?usp=share_link)
### for training
```
python train.py --scale 100 200 --optimizer adam --lr 1e-4
```
### for testing
* single file
example for testing the com-youtube dataset with GPU
```
python test.py --graph_path hw1_data/youtube/com-youtube.txt \
--bc_path hw1_data/youtube/com-youtube_score.txt \
--model_path model_result/1000_1200.pth --device gpu
```
* hw1_data (multiple files)
example for testing all hw1 synthetic 5000 nodes data (and the result will stored in **result.txt**)
```
rm result.txt
bash test.sh
```
## Baseline Comparison
* Node2Vec: [PyG Node2Vec](https://pytorch-geometric.readthedocs.io/en/latest/_modules/torch_geometric/nn/models/node2vec.html)
* kadraba: [Networkit](https://networkit.github.io/)
* RK: [Networkit](https://networkit.github.io/)
## Result of my reproduction
### PCA plotting and graph
![depend](https://user-images.githubusercontent.com/38965858/228304628-8de9318f-1eef-4f49-9cee-835af4fc0c37.png)
### Training procedure
![](/reproduce/figure3.png)
近期下载者:
相关文件:
收藏者: