ZichaoHuang/TransE

rank of head entity in tail prediction

Closed this issue · 4 comments

Taking a specific tail entity prediction task (s, p, ?) for example, is the head entity s always ranked 0 in idx_head_prediction[::-1]? I.e., is the most promising tail entity ranked as 1 in idx_head_prediction[::-1]?

I don't think I fully understand your question, but I will try my best to answer it.
Firstly, idx_head_prediction is the prediction result of the head entity prediction task, not tail entity prediction.
Head entity prediction and tail entity prediction are launched seperatly during evaluation.

However, the model can't promise that the most promising entitiy is always ranked at top1 in its prediction result.
If the model is well trained, technically a more promising entity would be ranked before a less one.

@ZichaoHuang Sorry for the misleading that I mean idx_tail_prediction in this example. If I understand correctly, idx_tail_prediction is the prediction result of the tail entity prediction task (s, p, ?), but in a reversed order, so I thought the 0-th element in idx_tail_prediction[::-1] should be the most possible prediction for answering (s, p, ?), but I found the 0-th element seems to be the subject object s always.

So I guess, is the element with index 1 (instead of element with index 0) in idx_tail_prediction[::-1] the most possible prediction for answering (s, p, ?)?

but I found the 0-th element seems to be the subject object s always

This should not be true.

A idx_tail_prediction is the entire entity set ranked by the tail prediction score from the TransE model according to a specific <head, relation> input. Therefore, idx_tail_prediction[::-1][0] should be the entity with the highest tail prediction score instead of head.

I will check it. Thanks for your reply.