ComplEx
¶
Bases: KGEModel
The ComplEx model from the "Complex Embeddings for Simple Link Prediction" paper.
Entities and relations have complex embeddings, and the score is the real part of the Hermitian triple product
\[
d(h, r, t) = \textrm{Re}(\langle \mathbf{e}_h, \mathbf{e}_r,
\overline{\mathbf{e}_t} \rangle)
\]
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 |
Source code in mlx_graphs/nn/models/kge.py
from mlx_graphs.nn import ComplEx · mlx_graphs/nn/models/kge.py