KG2E

class KG2E(*, embedding_dim: int = 50, dist_similarity: str | ~pykeen.nn.sim.KG2ESimilarity | type[~pykeen.nn.sim.KG2ESimilarity] | None = None, dist_similarity_kwargs: ~collections.abc.Mapping[str, ~typing.Any] | None = None, c_min: float = 0.05, c_max: float = 5.0, entity_initializer: str | ~typing.Callable[[~torch.Tensor], ~torch.Tensor] | None = <function uniform_>, entity_constrainer: str | ~typing.Callable[[~torch.Tensor], ~torch.Tensor] | None = <function clamp_norm>, entity_constrainer_kwargs: ~collections.abc.Mapping[str, ~typing.Any] | None = None, relation_initializer: str | ~typing.Callable[[~torch.Tensor], ~torch.Tensor] | None = <function uniform_>, relation_constrainer: str | ~typing.Callable[[~torch.Tensor], ~torch.Tensor] | None = <function clamp_norm>, relation_constrainer_kwargs: ~collections.abc.Mapping[str, ~typing.Any] | None = None, **kwargs)[source]

Bases: ERModel

An implementation of KG2E from [he2015].

KG2E aims to explicitly model (un)certainties in entities and relations (e.g. influenced by the number of triples observed for these entities and relations). Therefore, entities and relations are represented by probability distributions, in particular by multi-variate Gaussian distributions \(\mathcal{N}(\mu, \Sigma)\) where the mean \(\mu \in \mathbb{R}^d\) denotes the position in the vector space and the diagonal variance \(\Sigma = diag(\sigma_1, \ldots, \sigma_d) \in \mathbb{R}^{d \times d}\) models the uncertainty.

Thus, we have two \(d\)-dimensional vectors each stored in an Embedding matrix for entities and also relations. The representations are then passed to the KG2EInteraction function to obtain scores.

Initialize KG2E.

Parameters:

Note

The parameter pair (dist_similarity, dist_similarity_kwargs) is used for pykeen.nn.sim.kg2e_similarity_resolver

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

Attributes Summary

constrainer_default_kwargs

The default settings for the entity constrainer

hpo_default

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

Attributes Documentation

constrainer_default_kwargs = {'dim': -1, 'maxnorm': 1.0, 'p': 2}

The default settings for the entity constrainer

hpo_default: ClassVar[Mapping[str, Any]] = {'c_max': {'high': 10.0, 'low': 1.0, 'type': <class 'float'>}, 'c_min': {'high': 0.1, 'low': 0.01, 'scale': 'log', 'type': <class 'float'>}, 'embedding_dim': {'high': 256, 'low': 16, 'q': 16, 'type': <class 'int'>}}

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