# TransD¶

class TransD(*, embedding_dim=50, relation_dim=None, interaction_kwargs=None, entity_initializer=<function xavier_uniform_>, relation_initializer=<pykeen.utils.compose object>, entity_constrainer=<function clamp_norm>, relation_constrainer=<function clamp_norm>, **kwargs)[source]

Bases: ERModel

An implementation of TransD from [ji2015].

TransD is an extension of pykeen.models.TransR that, like TransR, considers entities and relations as objects living in different vector spaces. However, instead of performing the same relation-specific projection for all entity embeddings, entity-relation-specific projection matrices $$\textbf{M}_{r,h}, \textbf{M}_{t,h} \in \mathbb{R}^{k \times d}$$ are constructed.

To do so, all head entities, tail entities, and relations are represented by two vectors, $$\textbf{e}_h, \hat{\textbf{e}}_h, \textbf{e}_t, \hat{\textbf{e}}_t \in \mathbb{R}^d$$ and $$\textbf{r}_r, \hat{\textbf{r}}_r \in \mathbb{R}^k$$, respectively. The first set of embeddings is used for calculating the entity-relation-specific projection matrices:

\begin{align}\begin{aligned}\textbf{M}_{r,h} = \hat{\textbf{r}}_r \hat{\textbf{e}}_h^{T} + \tilde{\textbf{I}}\\\textbf{M}_{r,t} = \hat{\textbf{r}}_r \hat{\textbf{e}}_t^{T} + \tilde{\textbf{I}}\end{aligned}\end{align}

where $$\tilde{\textbf{I}} \in \mathbb{R}^{k \times d}$$ is a $$k \times d$$ matrix with ones on the diagonal and zeros elsewhere. Next, $$\textbf{e}_h$$ and $$\textbf{e}_t$$ are projected into the relation space by means of the constructed projection matrices. Finally, the plausibility score for $$(h,r,t) \in \mathbb{K}$$ is given by:

$f(h,r,t) = -\|\textbf{M}_{r,h} \textbf{e}_h + \textbf{r}_r - \textbf{M}_{r,t} \textbf{e}_t\|_{2}^2$

Initialize the model.

Parameters:

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': 256, 'low': 16, 'q': 16, 'type': <class 'int'>}, 'relation_dim': {'high': 256, 'low': 16, 'q': 16, 'type': <class 'int'>}}

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