PairRE
- class PairRE(embedding_dim=200, p=1, power_norm=False, entity_initializer=<function uniform_>, entity_initializer_kwargs=None, entity_normalizer=<function normalize>, entity_normalizer_kwargs=None, relation_initializer=<function uniform_>, relation_initializer_kwargs=None, **kwargs)[source]
Bases:
ERModel
An implementation of PairRE from [chao2020].
Initialize PairRE via the
pykeen.nn.modules.PairREInteraction
interaction.- Parameters:
embedding_dim (
int
) – The entity embedding dimension \(d\).p (
int
) – The \(l_p\) norm.power_norm (
bool
) – Should the power norm be used?entity_initializer (
Union
[str
,Callable
[[FloatTensor
],FloatTensor
],None
]) – Entity initializer function. Defaults totorch.nn.init.uniform_()
entity_initializer_kwargs (
Optional
[Mapping
[str
,Any
]]) – Keyword arguments to be used when calling the entity initializerentity_normalizer (
Union
[str
,Callable
[[FloatTensor
],FloatTensor
],None
]) – Entity normalizer function. Defaults totorch.nn.functional.normalize()
entity_normalizer_kwargs (
Optional
[Mapping
[str
,Any
]]) – Keyword arguments to be used when calling the entity normalizerrelation_initializer (
Union
[str
,Callable
[[FloatTensor
],FloatTensor
],None
]) – Relation initializer function. Defaults totorch.nn.init.uniform_()
relation_initializer_kwargs (
Optional
[Mapping
[str
,Any
]]) – Keyword arguments to be used when calling the relation initializerkwargs – Remaining keyword arguments passed through to
pykeen.models.ERModel
.
Attributes Summary
The default entity normalizer parameters The entity representations are normalized to L2 unit length cf.
The default strategy for optimizing the model's hyper-parameters
The default parameters for the default loss function class
Attributes Documentation
- default_entity_normalizer_kwargs: ClassVar[Mapping[str, Any]] = {'dim': -1, 'p': 2}
The default entity normalizer parameters The entity representations are normalized to L2 unit length cf. https://github.com/alipay/KnowledgeGraphEmbeddingsViaPairedRelationVectors_PairRE/blob/0a95bcd54759207984c670af92ceefa19dd248ad/biokg/model.py#L232-L240 # noqa: E501