What are knowledge graph embeddings (TransE, RotatE, ComplEx)?
sobes.tech AI
Answer from AI
Knowledge graph embeddings are methods of representing entities and relationships from knowledge graphs as vectors in a continuous space. This allows the use of machine learning for graph-related tasks, such as link prediction or classification.
Main models:
-
TransE: models relationships as vectors added to entity vectors. If (h, r, t) is a triple (head, relation, tail), then the model aims for ( h + r \approx t ). Simple and effective, but performs poorly with many-to-many relationships.
-
RotatE: extends the idea of TransE by representing relationships as rotations in the complex plane. This allows better modeling of various relationship types, including symmetric and antisymmetric.
-
ComplEx: uses complex vectors to represent entities and relationships, enabling the modeling of asymmetric relationships through complex conjugation.
Example of TransE idea:
If we have a fact: (Paris, capital_of_country, France), then the vectors should satisfy ( ext{Paris} + ext{capital_of_country} \approx ext{France} ).
These methods help efficiently encode the structure and semantics of a graph for further analysis and predictions.
sobes.tech AI
Answer from AI
Knowledge graph embedding is a method of representing entities and relationships from a knowledge graph as vectors in a continuous space. This allows for effective use of knowledge graphs in machine learning tasks, such as predicting new links or classification.
Main models:
-
TransE: models relationships as vector shifts. For a triplet (head, relation, tail), it tries to make the vector of the head plus the vector of the relation close to the vector of the tail. A simple and fast model, works well for "one-to-one" relationships.
-
DistMult: uses a bilinear form with a diagonal matrix for relationships. It evaluates the plausibility of a triplet through the scalar product of the head, relation, and tail vectors. Good for symmetric relationships.
-
ComplEx: extends DistMult into the complex space, allowing the modeling of asymmetric relationships thanks to complex numbers and their conjugates.
-
RotatE: represents relationships as rotations in the complex plane. The head rotates by an angle corresponding to the relation to produce the tail. It can model various properties of relationships (symmetry, asymmetry, inversion).
Example of using TransE (pseudocode):
# head + relation ≈ tail
head_vec = embedding['Paris']
relation_vec = embedding['isCapitalOf']
tail_vec = embedding['France']
score = -np.linalg.norm(head_vec + relation_vec - tail_vec)