I was trying to use RGCN implementation for link prediction, however, it does not work.
The problem arises when I try to evaluate the model. In the case of FB15k-237, it works, however, with wn18 it does not. Namely, it crashes in the function perturb_and_get_rank
. This issue is exactly the same as in this question, however, I am using built-in dataset instead of a custom one.
The main issue, I think, is the way number of batches is calculated: n_batch = (num_entity + batch_size - 1) // batch_size
The comment says that we want to perturb one element in the triples, however, the number of triples is different from the number of entities. Therefore, in the case when num_entity < num_triples
, we would skip some triples or do empty iterations in the case when num_entity > num_triples
.
Could you, please, comment on why the number of batches is calculated this way?
Also, could you, please, explain why perturbation leads to a correct calculation of MRR?
Thanks.