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

Initialize the model.

Parameters:
  • embedding_dim (int) – the embedding dimension

  • entity_initializer (Union[str, Callable[[FloatTensor], FloatTensor], None]) – the entity representation initializer

  • relation_initializer (Union[str, Callable[[FloatTensor], FloatTensor], None]) – the relation representation initializer

  • relation_constrainer (Union[str, Callable[[FloatTensor], FloatTensor], None]) – the relation representation constrainer

  • regularizer (Union[str, Regularizer, Type[Regularizer], None]) – the regularizer

  • regularizer_kwargs (Optional[Mapping[str, Any]]) – additional keyword-based parameters passed to the regularizer

  • kwargs – additional keyword-based parameters passed to ERModel.__init__()

Attributes Summary

hpo_default

The default strategy for optimizing the model's hyper-parameters

Attributes Documentation

hpo_default: ClassVar[Mapping[str, Any]] = {'embedding_dim': {'high': 1024, 'low': 32, 'q': 16, 'type': <class 'int'>}}

The default strategy for optimizing the model’s hyper-parameters