MuRE

class MuRE(*, embedding_dim: int = 200, p: int = 2, power_norm: bool = True, entity_initializer: str | ~collections.abc.Callable[[~torch.Tensor], ~torch.Tensor] | None = <function normal_>, entity_initializer_kwargs: ~collections.abc.Mapping[str, ~typing.Any] | None = None, entity_bias_initializer: str | ~collections.abc.Callable[[~torch.Tensor], ~torch.Tensor] | None = <function zeros_>, relation_initializer: str | ~collections.abc.Callable[[~torch.Tensor], ~torch.Tensor] | None = <function normal_>, relation_initializer_kwargs: ~collections.abc.Mapping[str, ~typing.Any] | None = None, relation_matrix_initializer: str | ~collections.abc.Callable[[~torch.Tensor], ~torch.Tensor] | None = <function uniform_>, relation_matrix_initializer_kwargs: ~collections.abc.Mapping[str, ~typing.Any] | None = None, **kwargs)[source]

Bases: ERModel[tuple[Tensor, Tensor], tuple[Tensor, Tensor], tuple[Tensor, Tensor]]

An implementation of MuRE from [balazevic2019b].

This model represents entities as \(d\)-dimensional vectors, and relations by two \(k\)-dimensional vectors. Moreover, there are separate scalar biases for each entity and each role (head or tail). All representations are stored in Embedding matrices.

The MuREInteraction function is used to obtain scores.

Initialize MuRE via the pykeen.nn.modules.MuREInteraction interaction.

Parameters:
  • embedding_dim (int) – The entity embedding dimension \(d\). Defaults to 200. Is usually \(d \in [50, 300]\).

  • 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 torch.nn.init.normal_()

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

  • entity_bias_initializer (str | Callable[[Tensor], Tensor] | None) – Entity bias initializer function. Defaults to torch.nn.init.zeros_()

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

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

  • relation_matrix_initializer (str | Callable[[Tensor], Tensor] | None) – Relation matrix initializer function. Defaults to torch.nn.init.uniform_()

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

  • kwargs – Remaining keyword arguments passed through to 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