Unverified Commit 9488bace authored by Hao Xiong's avatar Hao Xiong Committed by GitHub
Browse files

[Fix] fix some typos in example/ogb/deepwalk/ (#2190)



* line

* two lines

* update readme

* readme

* update readme

* update
Co-authored-by: default avatarZihao Ye <expye@outlook.com>
Co-authored-by: default avatarxiang song(charlie.song) <classicxsong@gmail.com>
parent 1b2658b9
......@@ -101,12 +101,12 @@ python3 mlp.py --device 2 --runs 10
ogbl-citation
```
python3 deepwalk.py --ogbl_name ogbl-citation --load_from_ogbl --save_in_pt --output_emb_file embedding.pt --window_size 2 --num_walks 10 --negative 1 --neg_weight 1 --walk_length 80 --batch_size 128 --print_loss --print_interval 1000 --mix --gpus 0 --use_context_weight --num_threads 4 --lap_norm 0.05 --lr 0.1
python3 deepwalk.py --ogbl_name ogbl-citation --load_from_ogbl --save_in_pt --output_emb_file embedding.pt --window_size 2 --num_walks 10 --negative 1 --neg_weight 1 --walk_length 80 --batch_size 128 --print_loss --print_interval 1000 --mix --gpus 0 --use_context_weight --num_threads 4 --lap_norm 0.01 --lr 0.1
cp embedding_pt_file_path ./
python3 mlp.py --device 2 --runs 10 --use_node_embedding
```
### OGBL Resuls
### OGBL Results
ogbl-collab
<br>#params: 61258346(model) + 131841(mlp) = 61390187
<br>Hits@10
......@@ -143,7 +143,6 @@ ogbl-collab
<br>&emsp;&emsp;Final Train: 50.99 ± 1.72
<br>&emsp;&emsp;Final Test: 33.56 ± 3.95
<br>ogbl-ppa
<br>#params: 150024820(model) + 113921(mlp) = 150138741
<br>Hits@10
......@@ -165,8 +164,22 @@ ogbl-collab
<br>ogbl-citation
<br>#params: 757811178(model) + 131841(mlp) = 757943019
<br>MRR
<br>&emsp;Highest Train: 0.8994 ± 0.0004
<br>&emsp;Highest Valid: 0.8271 ± 0.0003
<br>&emsp;&emsp;Final Train: 0.8991 ± 0.0007
<br>&emsp;&emsp;Final Test: 0.8284 ± 0.0005
<br>&emsp;Highest Train: 0.9381 ± 0.0003
<br>&emsp;Highest Valid: 0.8469 ± 0.0003
<br>&emsp;&emsp;Final Train: 0.9377 ± 0.0004
<br>&emsp;&emsp;Final Test: 0.8479 ± 0.0003
### Notes
#### Multi-GPU issues
For efficiency, the results of ogbl-collab, ogbl-ppa, ogbl-ddi are run with multi-GPU. Since ogb is somehow incompatible with our multi-GPU implementation, we need to do some preprocessing. The command is:
```
python3 load_dataset.py --name dataset_name
```
It will output a data file to the local. For example, if `dataset_name` is `ogbl-collab`, then a file `ogbl-collab-net.txt` will be generated. Then we run
```
python3 deepwalk.py --data_file data_file_path
```
where the other parameters are the same with used configs without using `--load_from_ogbl` and `--ogbl_name`.
#### Others
The performance on ogbl-ddi and ogbl-ppa can be not that stable.
\ No newline at end of file
......@@ -2,6 +2,7 @@
import argparse
from ogb.linkproppred import DglLinkPropPredDataset
import time
def load_from_ogbl_with_name(name):
choices = ['ogbl-collab', 'ogbl-ddi', 'ogbl-ppa', 'ogbl-citation']
......@@ -17,6 +18,7 @@ if __name__ == "__main__":
help="name of datasets by ogb")
args = parser.parse_args()
print("loading graph... it might take some time")
name = args.name
g = load_from_ogbl_with_name(name=name)
......@@ -26,13 +28,23 @@ if __name__ == "__main__":
except:
weighted = False
edge_num = g.edges()[0].shape[0]
src = list(g.edges()[0])
tgt = list(g.edges()[1])
if weighted:
weight = list(g.edata['edge_weight'])
print("writing...")
start_time = time.time()
with open(name + "-net.txt", "w") as f:
for i in range(g.edges()[0].shape[0]):
for i in range(edge_num):
if weighted:
f.write(str(g.edges()[0][i].item()) + " "\
+str(g.edges()[1][i].item()) + " "\
+str(g.edata['edge_weight'][i].item()) + "\n")
f.write(str(src[i].item()) + " "\
+str(tgt[i].item()) + " "\
+str(weight[i].item()) + "\n")
else:
f.write(str(g.edges()[0][i].item()) + " "\
+str(g.edges()[1][i].item()) + " "\
+"1\n")
\ No newline at end of file
f.write(str(src[i].item()) + " "\
+str(tgt[i].item()) + " "\
+"1\n")
print("writing used time: %d s" % int(time.time() - start_time))
\ No newline at end of file
......@@ -111,7 +111,7 @@ def net2graph(net_sm):
return G
def make_undirected(G):
G.readonly(False)
#G.readonly(False)
G.add_edges(G.edges()[1], G.edges()[0])
return G
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment