migalkin / StarE

EMNLP 2020: Message Passing for Hyper-Relational Knowledge Graphs
MIT License
85 stars 17 forks source link

About Corruption #15

Open lainanhui opened 5 months ago

lainanhui commented 5 months ago

Hi, I would like to ask the Corruption function in the code is used to generate negative samples, but I didn't find out how negative samples are used? If it is used, I would like to ask how the link prediction task uses the negative sample

migalkin commented 5 months ago

The corruption function exists indeed but it's not used in training - instead, during training, we use 1-N scoring meaning that the final prediction is of shape [batch_size, num_entities] - for each statement in the batch, labels are a multi-hot encoded vector where 1's are true answers, 0's are all other entities. Since we already operate in the space of all entities in the graph, there is no need for sampling Having said that, you can use the corruption function for writing your own training loop with negative sampling