ConvKB

class ConvKB(*, embedding_dim: int = 200, hidden_dropout_rate: float = 0.0, num_filters: int = 400, regularizer: ~pykeen.regularizers.Regularizer | None = None, entity_initializer: str | ~typing.Callable[[~torch.Tensor], ~torch.Tensor] | None = <function uniform_>, relation_initializer: str | ~typing.Callable[[~torch.Tensor], ~torch.Tensor] | None = <function uniform_>, **kwargs)[source]

Bases: ERModel[Tensor, Tensor, Tensor]

An implementation of ConvKB from [nguyen2018].

ConvKB represents entities and relations using a \(d\)-dimensional embedding vectors, which are stored as Embedding. ConvKBInteraction is used to obtain triple scores.

See also

Initialize the model.

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

  • hidden_dropout_rate (float) – The hidden dropout rate

  • num_filters (int) – The number of convolutional filters to use

  • regularizer (Regularizer | None) – The regularizer to use. Defaults to \(L_p\)

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

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

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

To be consistent with the paper, pass entity and relation embeddings pre-trained from TransE.

Attributes Summary

hpo_default

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

regularizer_default_kwargs

The LP settings used by [nguyen2018] for ConvKB.

Attributes Documentation

hpo_default: ClassVar[Mapping[str, Any]] = {'embedding_dim': {'high': 256, 'low': 16, 'q': 16, 'type': <class 'int'>}, 'hidden_dropout_rate': {'high': 0.5, 'low': 0.0, 'q': 0.1, 'type': <class 'float'>}, 'num_filters': {'high': 9, 'low': 7, 'scale': 'power_two', 'type': <class 'int'>}}

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

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

The LP settings used by [nguyen2018] for ConvKB.