TimDettmers / ConvE

Convolutional 2D Knowledge Graph Embeddings resources
MIT License
674 stars 163 forks source link

A question about negative sampling #60

Closed nxznm closed 4 years ago

nxznm commented 4 years ago

Hello, sorry to bother you again! I found that in this paper, it doesn't note the technique about negative sampling, while it is noted in many modern KG embedding, like TransE, RotatE, ComplEx. In the beginning, I think you don't concern about negative triplets in ConvE, but reading your code and re-reading your paper, I find that in your network architecture, the last layer in the model, you make a matrix multiplication between the hidden layer embedding and the whole entity matrix. In short, given a head entity and a relation, the model outputs the probability of all the entity to be the tail entity. In the paper, you say that it can bolster the evaluation. And I think in the training stage, it just makes all the triplets that not in the train-dataset to be the negative ones. In this way, you needn't to concern about negative sampling. I want to know whether my thought about this is wrong. Wish you have a nice day! Thanks:)

TimDettmers commented 4 years ago

Thank you, this is a good observation and your description is correct. To put it in my own words: The procedure is equivalent to negative sampling where your negative sample includes all entities which are not present in the dataset. All other tail entities associated with the head and relation are positive.

nxznm commented 4 years ago

Thanks for your reply :)