TransE¶
- class ampligraph.latent_features.layers.scoring.TransE(*args: Any, **kwargs: Any)¶
Translating Embeddings (TransE) scoring layer.
The model as described in [BUGD+13].
The scoring function of TransE computes a similarity between the embedding of the subject \(\mathbf{e}_{sub}\) translated by the embedding of the predicate \(\mathbf{e}_{pred}\), and the embedding of the object \(\mathbf{e}_{obj}\), using the \(L_1\) or \(L_2\) norm \(||\cdot||\) (default: \(L_1\)):
\[f_{TransE}=-||\mathbf{e}_{sub} + \mathbf{e}_{pred} - \mathbf{e}_{obj}||\]Such scoring function is then used on positive and negative triples \(t^+, t^-\) in the loss function.
Attributes
class_paramsexternal_paramsnameMethods
__init__(k)Initializes the scoring layer.
get_config()- __init__(k)¶
Initializes the scoring layer.
- Parameters
k (int) – Embedding size.
max_rel_size (int) – This value specifies the number of relations in the KG. It is essential only for
RotatEscoring layer (default: None).
- get_config()¶