uma-pi1 / kge

LibKGE - A knowledge graph embedding library for reproducible research
MIT License
765 stars 124 forks source link

ConvE and reciprocal_relations_model #262

Closed oliver-lloyd closed 2 years ago

oliver-lloyd commented 2 years ago

Could somebody explain the relationship between ConvE and the reciprocal model in this software.

I am familiar with the issue of inverse relation leakage, which Dettmers showed in his paper. In his work however, he presents ConvE and the inverse model separately:

To gauge the severity of this [reciprocal relation] problem, we construct a simple, rule-based model that solely models inverse relations. We call this model the inverse model. The model extracts inverse relationships automatically from the training set: given two relation pairs r1, r2 ∈ R, we check whether (s, r1, o) implies (o, r2, s), or vice-versa.

This clearly differs from ConvE, which is based on convolutions over 2d embeddings. However, in kge/model/conve.yaml is written:

# Should only be used with reciprocal relations: # - model: reciprocal_relations_model # - reciprocal_relations_model.base_model.type: conve

... and when I try to run a search with model fixed as ConvE, the experiment exits with 'Exception("Combine _po not supported in ConvE's score function")'.

I am looking for clarification on what the reciprocal relations model does, and why the ConvE model can only be implemented using it.

Many thanks.

rgemulla commented 2 years ago

That's unrelated to inverse model that you quote. The use of reciprocal relations simply means that (i) for each triple (s,p,o), we add a triple (o, p^-, s) to the training data, where p^- is a new relation (the "reciprocal" one), and (ii) we only predict objects, i.e., a query of form (?, p, o) is rewritten to (o, p^-, ?). This makes it possible to use models that can only score objects, such as ConvE.

See here, at the end of Sec. 2, for a discussion and references.

oliver-lloyd commented 2 years ago

Thank you!