TransD
- class TransD(*, embedding_dim: int = 50, relation_dim: int | None = None, interaction_kwargs: ~collections.abc.Mapping[str, ~typing.Any] | None = None, entity_initializer: str | ~typing.Callable[[~torch.Tensor], ~torch.Tensor] | None = <function xavier_uniform_>, entity_constrainer: str | ~typing.Callable[[~torch.Tensor], ~torch.Tensor] | None = <function clamp_norm>, relation_initializer: str | ~typing.Callable[[~torch.Tensor], ~torch.Tensor] | None = <pykeen.utils.compose object>, relation_constrainer: str | ~typing.Callable[[~torch.Tensor], ~torch.Tensor] | None = <function clamp_norm>, **kwargs)[source]
Bases:
ERModel
[tuple
[Tensor
,Tensor
],tuple
[Tensor
,Tensor
],tuple
[Tensor
,Tensor
]]An implementation of TransD from [ji2015].
This model represents both entities as pairs of \(d\)-dimensional vectors, and relations as pairs of \(k\)-dimensional vectors. Both, entity and relation embedding vectors are constrained to \(\|\cdot\|_2 \leq 1\). They are stored in an
Embedding
matrix. The representations are then passed to theTransDInteraction
function to obtain scores.See also
OpenKE implementation of TransD
Initialize the model.
- Parameters:
embedding_dim (int) – The (entity) embedding dimension.
relation_dim (int | None) – The relation embedding dimension. Defaults to
embedding_dim
.interaction_kwargs (Mapping[str, Any] | None) – Additional keyword-based parameters passed to
TransDInteraction
.entity_initializer (str | Callable[[Tensor], Tensor] | None) – The entity representation initializer. Defaults to
pykeen.nn.init.xavier_uniform_()
.entity_constrainer (str | Callable[[Tensor], Tensor] | None) – The entity representation constrainer. Defaults to
pykeen.utils.clamp_norm()
.relation_initializer (str | Callable[[Tensor], Tensor] | None) – The relation representation initializer. Defaults to
pykeen.nn.init.xavier_uniform_norm_()
.relation_constrainer (str | Callable[[Tensor], Tensor] | None) – The relation representation constrainer. Defaults to
pykeen.utils.clamp_norm()
.kwargs – Additional keyword-based parameters passed to
ERModel
.
Attributes Summary
The default strategy for optimizing the model's hyper-parameters
Attributes Documentation