SimplE

class SimplE(*, embedding_dim: int = 200, clamp_score: tuple[float | None, float] | tuple[float, float | None] | float | None = None, entity_initializer: str | Callable[[Tensor], Tensor] | None = None, relation_initializer: str | Callable[[Tensor], Tensor] | None = None, regularizer: str | Regularizer | None = None, regularizer_kwargs: Mapping[str, Any] | None = None, **kwargs)[source]

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

An implementation of SimplE [kazemi2018].

SimplE learns two \(d\)-dimensional vectors for each entity and each relation, stored in Embedding, and applies the SimplEInteraction on top.

Note

In the code in their repository, the score is clamped to \([-20, 20]\). That is not mentioned in the paper, so it is made optional.

See also

Initialize the model.

Parameters:
  • embedding_dim (int) – the embedding dimension

  • clamp_score (Clamp | float | None) – whether to clamp scores, cf. ClampedInteraction

  • entity_initializer (Hint[Initializer]) – the entity representation initializer

  • relation_initializer (Hint[Initializer]) – the relation representation initializer

  • regularizer (Hint[Regularizer]) – the regularizer, defaults to SimplE.regularizer_default

  • regularizer_kwargs (OptionalKwargs) – additional keyword-based parameters passed to the regularizer, defaults to SimplE.regularizer_default_kwargs

  • kwargs – additional keyword-based parameters passed to ERModel.__init__()

Attributes Summary

hpo_default

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

loss_default_kwargs

The default parameters for the default loss function class

regularizer_default_kwargs

The power sum settings used by [trouillon2016] for SimplE

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

loss_default_kwargs: ClassVar[Mapping[str, Any]] = {}

The default parameters for the default loss function class

regularizer_default_kwargs: ClassVar[Mapping[str, Any]] = {'normalize': True, 'p': 2.0, 'weight': 20}

The power sum settings used by [trouillon2016] for SimplE