RotatE
- class RotatE(*, embedding_dim: int = 200, entity_initializer: str | ~typing.Callable[[~torch.Tensor], ~torch.Tensor] | None = <function xavier_uniform_>, relation_initializer: str | ~typing.Callable[[~torch.Tensor], ~torch.Tensor] | None = <function init_phases>, relation_constrainer: str | ~typing.Callable[[~torch.Tensor], ~torch.Tensor] | None = <function complex_normalize>, regularizer: str | ~pykeen.regularizers.Regularizer | type[~pykeen.regularizers.Regularizer] | None = None, regularizer_kwargs: ~collections.abc.Mapping[str, ~typing.Any] | None = None, **kwargs)[source]
Bases:
ERModel
[Tensor
,Tensor
,Tensor
]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 dimension
entity_initializer (str | Callable[[Tensor], Tensor] | None) – the entity representation initializer
relation_initializer (str | Callable[[Tensor], Tensor] | None) – the relation representation initializer
relation_constrainer (str | Callable[[Tensor], Tensor] | None) – the relation representation constrainer
regularizer (str | Regularizer | type[Regularizer] | None) – the regularizer
regularizer_kwargs (Mapping[str, Any] | None) – additional keyword-based parameters passed to the regularizer
kwargs – additional keyword-based parameters passed to
ERModel.__init__()
Attributes Summary
The default strategy for optimizing the model's hyper-parameters
Attributes Documentation