AnselCmy / MetaR

Source code for the EMNLP 2019 paper "Meta Relational Learning for Few-Shot Link Prediction in Knowledge Graphs"
Apache License 2.0
111 stars 19 forks source link

Question about the score function #9

Closed RManLuo closed 2 years ago

RManLuo commented 2 years ago

Hi,

First thanks for the wonderful work you have done. I have a question related to the score function hoping you can help.

In the paper, you use the score function in TransE to predict the score of the triplet. From my understanding, the score function of TransE assumes the scores of positive triplets are smaller than the scores of negative triplets, which is also shown in equation 4. image

However, in the implementation, you try to maximize the score of the positive triplets as shown in https://github.com/AnselCmy/MetaR/blob/47897ef0268b2c6c00e211be26a983d201e54565/trainer.py#L123-L132 and sort the candidate scores by descending in https://github.com/AnselCmy/MetaR/blob/47897ef0268b2c6c00e211be26a983d201e54565/trainer.py#L104-L118

So I wonder which is the correct one?

RManLuo commented 2 years ago

Sorry, I notice that you use the negative score in https://github.com/AnselCmy/MetaR/blob/47897ef0268b2c6c00e211be26a983d201e54565/models.py#L48