SE
- class SE(*, embedding_dim=50, scoring_fct_norm=1, entity_initializer=<function xavier_uniform_>, entity_constrainer=<function normalize>, entity_constrainer_kwargs=None, relation_initializer=<pykeen.utils.compose object>, **kwargs)[source]
Bases:
pykeen.models.nbase.ERModel
An implementation of the Structured Embedding (SE) published by [bordes2011].
SE applies role- and relation-specific projection matrices \(\textbf{M}_{r}^{h}, \textbf{M}_{r}^{t} \in \mathbb{R}^{d \times d}\) to the head and tail entities’ embeddings before computing their differences. Then, the \(l_p\) norm is applied and the result is negated such that smaller differences are considered better.
\[f(h, r, t) = - \|\textbf{M}_{r}^{h} \textbf{e}_h - \textbf{M}_{r}^{t} \textbf{e}_t\|_p\]By employing different projections for the embeddings of the head and tail entities, SE explicitly differentiates the role of an entity as either the subject or object.
Initialize SE.
- Parameters
embedding_dim (
int
) – The entity embedding dimension \(d\). Is usually \(d \in [50, 300]\).scoring_fct_norm (
int
) – The \(l_p\) norm. Usually 1 for SE.entity_initializer (
Union
[str
,Callable
[[FloatTensor
],FloatTensor
],None
]) – Entity initializer function. Defaults topykeen.nn.init.xavier_uniform_()
entity_constrainer (
Union
[str
,Callable
[[FloatTensor
],FloatTensor
],None
]) – Entity constrainer function. Defaults totorch.nn.functional.normalize()
entity_constrainer_kwargs (
Optional
[Mapping
[str
,Any
]]) – Keyword arguments to be used when calling the entity constrainerrelation_initializer (
Union
[str
,Callable
[[FloatTensor
],FloatTensor
],None
]) – Relation initializer function. Defaults topykeen.nn.init.xavier_uniform_norm_()
kwargs – Remaining keyword arguments to forward to
pykeen.models.EntityEmbeddingModel
Attributes Summary
The default strategy for optimizing the model's hyper-parameters
Attributes Documentation