ERMLP

class ERMLP(*, embedding_dim=64, hidden_dim=None, entity_initializer=<function uniform_>, relation_initializer=<function uniform_>, **kwargs)[source]

Bases: ERModel

An implementation of ERMLP from [dong2014].

ERMLP is a multi-layer perceptron based approach that uses a single hidden layer and represents entities and relations as vectors. In the input-layer, for each triple the embeddings of head, relation, and tail are concatenated and passed to the hidden layer. The output-layer consists of a single neuron that computes the plausibility score of the triple:

\[f(h,r,t) = \textbf{w}^{T} g(\textbf{W} [\textbf{h}; \textbf{r}; \textbf{t}]),\]

where \(\textbf{W} \in \mathbb{R}^{k \times 3d}\) represents the weight matrix of the hidden layer, \(\textbf{w} \in \mathbb{R}^{k}\), the weights of the output layer, and \(g\) denotes an activation function such as the hyperbolic tangent.

Initialize the model.

Attributes Summary

hpo_default

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

Attributes Documentation

Parameters:
  • embedding_dim (int) –

  • hidden_dim (int | None) –

  • entity_initializer (str | Callable[[FloatTensor], FloatTensor] | None) –

  • relation_initializer (str | Callable[[FloatTensor], FloatTensor] | None) –

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