ERMLP

class ERMLP(*, embedding_dim: int = 64, hidden_dim: int | None = None, activation: str | ~torch.nn.modules.module.Module | type[~torch.nn.modules.module.Module] | None = <class 'torch.nn.modules.activation.ReLU'>, activation_kwargs: ~collections.abc.Mapping[str, ~typing.Any] | None = None, entity_initializer: str | ~collections.abc.Callable[[~torch.Tensor], ~torch.Tensor] | None = <function uniform_>, relation_initializer: str | ~collections.abc.Callable[[~torch.Tensor], ~torch.Tensor] | None = <function uniform_>, **kwargs)[source]

Bases: ERModel[Tensor, Tensor, Tensor]

An implementation of ERMLP from [dong2014].

This model represents both entities and relations as \(d\)-dimensional vectors stored in an Embedding matrix. The representations are then passed to the ERMLPInteraction function to obtain scores.

Initialize the model.

Parameters:
  • embedding_dim (int) – The embedding vector dimension for entities and relations.

  • hidden_dim (int | None) – The hidden dimension of the MLP. Defaults to embedding_dim.

  • activation (str | Module | type[Module] | None) – The activation function or a hint thereof.

  • activation_kwargs (Mapping[str, Any] | None) – Additional keyword-based parameters passed to the activation’s constructor, if the activation is not pre-instantiated.

  • entity_initializer (str | Callable[[Tensor], Tensor] | None) – the method to initialize the entity embeddings

  • relation_initializer (str | Callable[[Tensor], Tensor] | None) – the method to initialize the entity embeddings

  • kwargs – additional keyword-based parameters passed to pykeen.models.ERModel

Note

The parameter pair (activation, activation_kwargs) is used for class_resolver.contrib.torch.activation_resolver

An explanation of resolvers and how to use them is given in https://class-resolver.readthedocs.io/en/latest/.

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'>}}

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