class ProjE(*, embedding_dim=50, inner_non_linearity=None, entity_initializer=<function xavier_uniform_>, relation_initializer=<function xavier_uniform_>, **kwargs)[source]

Bases: ERModel

An implementation of ProjE from [shi2017].

ProjE is a neural network-based approach with a combination and a projection layer. The interaction model first combines \(h\) and \(r\) by following combination operator:

\[\textbf{h} \otimes \textbf{r} = \textbf{D}_e \textbf{h} + \textbf{D}_r \textbf{r} + \textbf{b}_c\]

where \(\textbf{D}_e, \textbf{D}_r \in \mathbb{R}^{k \times k}\) are diagonal matrices which are used as shared parameters among all entities and relations, and \(\textbf{b}_c \in \mathbb{R}^{k}\) represents the candidate bias vector shared across all entities. Next, the score for the triple \((h,r,t) \in \mathbb{K}\) is computed:

\[f(h, r, t) = g(\textbf{t} \ z(\textbf{h} \otimes \textbf{r}) + \textbf{b}_p)\]

where \(g\) and \(z\) are activation functions, and \(\textbf{b}_p\) represents the shared projection bias vector.

See also

Initialize the model.

  • embedding_dim (int) – the embedding dimension

  • inner_non_linearity (Optional[Module]) – the inner non-linearity, of a hint thereof. cf. ProjEInteraction.__init__()

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

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

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

Attributes Summary


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


The default parameters for the default loss function class

Attributes Documentation

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

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

loss_default_kwargs: ClassVar[Mapping[str, Any] | None] = {'reduction': 'mean'}

The default parameters for the default loss function class