SimplEInteraction

class SimplEInteraction[source]

Bases: DirectionAverageInteraction

The SimplE interaction function.

SimplE can be regarded as extension of (a special case of) pykeen.nn.modules.CPInteraction, an early tensor factorization approach in which each entity \(e \in \mathcal{E}\) is represented by two vectors \(\mathbf{e}_h, \mathbf{e}_t \in \mathbb{R}^d\) and each relation by a single vector \(\mathbf{r} \in \mathbb{R}^d\). Depending whether an entity participates in a triple as the head or tail entity, either \(\mathbf{e}_h\) or \(\mathbf{e}_t\) is used. Both entity representations are learned independently, i.e. observing a triple \((h,r,t)\), the method only updates \(\mathbf{h}_h\) and \(\mathbf{t}_t\). In contrast to CPInteraction, SimplE introduces separate weights for each relation: \(\textbf{r}_{\rightarrow}\) and \(\textbf{r}_{\leftarrow}\) for the inverse relation. The interaction model is based on both:

\[\frac{1}{2}\left( \left\langle\textbf{h}_{h}, \textbf{r}_{\rightarrow}, \textbf{t}_{t}\right\rangle + \left\langle\textbf{t}_{h}, \textbf{r}_{\leftarrow}, \textbf{h}_{t}\right\rangle \right)\]

Initialize the interaction module.

Attributes Summary

entity_shape

The symbolic shapes for entity representations

relation_shape

The symbolic shapes for relation representations

Attributes Documentation

entity_shape: Sequence[str] = ('d', 'd')

The symbolic shapes for entity representations

relation_shape: Sequence[str] = ('d', 'd')

The symbolic shapes for relation representations