TorusE

class TorusE(embedding_dim: int = 256, p: int = 2, power_norm: bool = False, entity_initializer: str | Callable[[Tensor], Tensor] | None = None, entity_initializer_kwargs: Mapping[str, Any] | None = None, entity_normalizer: str | Callable[[Tensor], Tensor] | None = None, entity_normalizer_kwargs: Mapping[str, Any] | None = None, relation_initializer: str | Callable[[Tensor], Tensor] | None = None, relation_initializer_kwargs: Mapping[str, Any] | None = None, **kwargs)[source]

Bases: ERModel[Tensor, Tensor, Tensor]

An implementation of TorusE from [ebisu2018].

Initialize TorusE via the pykeen.nn.modules.TorusEInteraction interaction.

Parameters:
  • embedding_dim (int) – The entity embedding dimension \(d\).

  • p (int) – The norm used with torch.linalg.vector_norm(). Typically is 1 or 2.

  • power_norm (bool) – Whether to use the p-th power of the \(L_p\) norm. It has the advantage of being differentiable around 0, and numerically more stable.

  • entity_initializer (str | Callable[[Tensor], Tensor] | None) – Entity initializer function. Defaults to None

  • entity_initializer_kwargs (Mapping[str, Any] | None) – Keyword arguments to be used when calling the entity initializer

  • entity_normalizer (str | Callable[[Tensor], Tensor] | None) – Entity normalizer function. Defaults to None

  • entity_normalizer_kwargs (Mapping[str, Any] | None) – Keyword arguments to be used when calling the entity normalizer

  • relation_initializer (str | Callable[[Tensor], Tensor] | None) – Relation initializer function. Defaults to None

  • relation_initializer_kwargs (Mapping[str, Any] | None) – Keyword arguments to be used when calling the relation initializer

  • kwargs – Remaining keyword arguments passed through to pykeen.models.ERModel.

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'>}, 'p': {'high': 2, 'low': 1, 'type': <class 'int'>}}

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