Closed huanghjA closed 3 years ago
Yes. It should be score = head + relations - tail
dglke_train --model_name TransR --dataset FB15k \
--batch_size 1000 --log_interval 1000 --neg_sample_size 200 --hidden_dim 200 --gamma 5.0 --lr 0.01 --max_step 10000 \
--mix_cpu_gpu --test --num_thread 4 --num_proc 4 --gpu 0 1 2 3 --async_update --rel_part --force_sync_interval 1000 --save_path ./vector/
I changed this bug and retrained TransR in dataset FB15k with above command. The result is out of my exceptation:
Test average MRR : 0.3202662672652113
Test average MR : 112.90473328706133
Test average HITS@1 : 0.21207529921619744
Test average HITS@3 : 0.3664911716409067
Test average HITS@10 : 0.5231924294493068
While the result is better before the bug fixed as following:
Test average MRR : 0.5947425085314608
Test average MR : 83.3528127169
Test average HITS@1 : 0.5282033485128066
Test average HITS@3 : 0.6258908770801239
Test average HITS@10 : 0.7150632289956155
It makes me so confused.
You may need to do some hyperparameter tuning.
In dgl-ke/python/dglke/models/pytorch/score_fun.py: class TransRScore(): create_neg() if neg_head : score = head + relations - tail else :
score = head - relations - tail
Is the score in condition else is a bug?