DistMult
¶
Bases: KGEModel
The DistMult model from the "Embedding Entities and Relations for Learning and Inference in Knowledge Bases" paper.
Relations are diagonal matrices, which gives the score
\[
d(h, r, t) = \langle \mathbf{e}_h, \mathbf{e}_r, \mathbf{e}_t \rangle
\]
It is trained with a margin ranking 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. |
required |
margin
|
float
|
The margin of the ranking loss. Default: |
1.0
|
References
[1] Yang et al. Embedding Entities and Relations for Learning and Inference in Knowledge Bases
Source code in mlx_graphs/nn/models/kge.py
from mlx_graphs.nn import DistMult · mlx_graphs/nn/models/kge.py