soledad921 / ATISE

The source code of ISWC2020 paper "Temporal Knowledge Graph completion based on time series Gaussian embedding " and COLING2020 paper "TeRo: A Time-aware Knowledge Graph Embedding via Temporal Rotation "
MIT License
63 stars 10 forks source link

About inverse relation and Testing in both directions #6

Closed Ckeai closed 2 years ago

Ckeai commented 2 years ago

Thank you very much for sharing. I have some questions.

  1. I find that you use the inverse relationship and you corrupted head entity and tail entity to generate negative samples. Theoretically, you can use inverse relationship and only corrupted tail entity of each sample. For example, one sample is (Bob, is father of ,John), and it sample with inverse relationship is (John, {is father of }^{-1}, Bob). The effect of corrupt the tails of (Bob, is father of ,John) and (John, {is father of }^{-1}, Bob) is same as corrupt head entity and tail entity of (Bob, is father of ,John) .
  2. I find you only use inverse relationship in training set. Why not use it in test set and verification set?
soledad921 commented 2 years ago

Actually, I also use inverse relationship in test set and verification set (please check line 162 and 194 model.py). I score a fact (s,r,o) by summing f(s,r,o) and f(o,r^{-1},s) for training, and valuation. It can be regarded as a data augmentation trick.

Ckeai commented 2 years ago

Thank you for your reply, for second question, I don't think I made it clear. I mean that filter setting from 98 lines to 110 lines in Dataset.py. facts_pool = [self.training_facts,self.validation_facts,self.test_facts] , each fact in facts pool do not contain inverse relationship. I would appreciate it if you could answer my questions.

soledad921 commented 2 years ago

Thank you for your reply, for second question, I don't think I made it clear. I mean that filter setting from 98 lines to 110 lines in Dataset.py. facts_pool = [self.training_facts,self.validation_facts,self.test_facts] , each fact in facts pool do not contain inverse relationship. I would appreciate it if you could answer my questions.

We do not need filter facts invovling inverse relationships. For each testing fact (s,r,o), we score it by summing f(s,r,o) and f(o,r^{-1},s). For each fact (s,r,o') or (s',r,o) needed to be filtered, we also socre it by summing f(s',r,o)+ f(o,r-1,s') or f(s,r,o')+ f(o',r-1,s). In this way, we take inverse relationship into consideration in the filtered setting for evaluation

Ckeai commented 2 years ago

Thank you for your patience. I already understand. Wish you a happy life!:smile: