RotatE
- class RotatE(*, embedding_dim=200, entity_initializer=<function xavier_uniform_>, relation_initializer=<function init_phases>, relation_constrainer=<function complex_normalize>, regularizer=None, regularizer_kwargs=None, **kwargs)[source]
Bases:
ERModel
An implementation of RotatE from [sun2019].
RotatE models relations as rotations from head to tail entities in complex space:
\[\textbf{e}_t= \textbf{e}_h \odot \textbf{r}_r\]where \(\textbf{e}, \textbf{r} \in \mathbb{C}^{d}\) and the complex elements of \(\textbf{r}_r\) are restricted to have a modulus of one (\(\|\textbf{r}_r\| = 1\)). The interaction model is then defined as:
\[f(h,r,t) = -\|\textbf{e}_h \odot \textbf{r}_r - \textbf{e}_t\|\]which allows to model symmetry, antisymmetry, inversion, and composition.
See also
Authors’ implementation of RotatE
Initialize the model.
- Parameters:
embedding_dim (
int
) – the embedding dimensionentity_initializer (
Union
[str
,Callable
[[FloatTensor
],FloatTensor
],None
]) – the entity representation initializerrelation_initializer (
Union
[str
,Callable
[[FloatTensor
],FloatTensor
],None
]) – the relation representation initializerrelation_constrainer (
Union
[str
,Callable
[[FloatTensor
],FloatTensor
],None
]) – the relation representation constrainerregularizer (
Union
[str
,Regularizer
,Type
[Regularizer
],None
]) – the regularizerregularizer_kwargs (
Optional
[Mapping
[str
,Any
]]) – additional keyword-based parameters passed to the regularizerkwargs – additional keyword-based parameters passed to
ERModel.__init__()
Attributes Summary
The default strategy for optimizing the model's hyper-parameters
Attributes Documentation