ProjE
- 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
Official Implementation: https://github.com/nddsg/ProjE
Initialize the model.
- Parameters:
embedding_dim (
int
) – the embedding dimensioninner_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 initializerrelation_initializer (
Union
[str
,Callable
[[FloatTensor
],FloatTensor
],None
]) – the relation representation initializerkwargs – 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