RotatE
¶
Bases: KGEModel
The RotatE model from the "RotatE: Knowledge Graph Embedding by Relational Rotation in Complex Space" paper.
Relations are rotations in the complex plane, \(\mathbf{e}_t = \mathbf{e}_h \circ \mathbf{e}_r\) with \(|\mathbf{e}_r| = 1\), which gives the score
\[
d(h, r, t) = \gamma - {\| \mathbf{e}_h \circ \mathbf{e}_r -
\mathbf{e}_t \|}
\]
where \(\gamma\) is the margin. It is trained with a binary cross entropy loss.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_nodes
|
int
|
The number of nodes (entities) in the graph. |
required |
num_relations
|
int
|
The number of relations in the graph. |
required |
hidden_features_dim
|
int
|
The size of the embeddings (of both their real and imaginary parts). |
required |
margin
|
float
|
The margin \(\gamma\). Default: |
1.0
|
Source code in mlx_graphs/nn/models/kge.py
from mlx_graphs.nn import RotatE · mlx_graphs/nn/models/kge.py