BoxE
- class BoxE(*, embedding_dim=256, tanh_map=True, p=2, power_norm=False, entity_initializer=<pykeen.utils.compose object>, entity_initializer_kwargs=None, relation_initializer=<pykeen.utils.compose object>, relation_initializer_kwargs=None, relation_size_initializer=<function uniform_>, relation_size_initializer_kwargs=None, **kwargs)[source]
Bases:
pykeen.models.nbase.ERModel
An implementation of BoxE from [abboud2020].
Note
This implementation only currently supports unimodal knowledge graphs consisting only of binary facts, whereas the original BoxE applies to arbitrary facts of any arity, i.e., unary facts, binary facts, ternary facts, etc. For use on higher-arity knowledge bases, please refer to the original implementation at https://www.github.com/ralphabb/BoxE.
Initialize BoxE.
- Parameters
embedding_dim (
int
) – The entity embedding dimension \(d\). Defaults to 200. Is usually \(d \in [50, 300]\).tanh_map (
bool
) – Whether to use tanh mapping after BoxE computation (defaults to true). The hyperbolic tangent mapping restricts the embedding space to the range [-1, 1], and thus this map implicitly regularizes the space to prevent loss reduction by growing boxes arbitrarily large.p (
int
) – order of norm in score computationpower_norm (
bool
) – whether to use the p-th power of the norm insteadentity_initializer (
Union
[str
,Callable
[[FloatTensor
],FloatTensor
],None
]) – Entity initializer function. Defaults topykeen.nn.init.uniform_norm_()
entity_initializer_kwargs (
Optional
[Mapping
[str
,Any
]]) – Keyword arguments to be used when calling the entity initializerrelation_initializer (
Union
[str
,Callable
[[FloatTensor
],FloatTensor
],None
]) – Relation initializer function. Defaults topykeen.nn.init.uniform_norm_()
relation_initializer_kwargs (
Optional
[Mapping
[str
,Any
]]) – Keyword arguments to be used when calling the relation initializerrelation_size_initializer (
Union
[str
,Callable
[[FloatTensor
],FloatTensor
],None
]) – Relation initializer function. Defaults totorch.nn.init.uniform_()
Defaults totorch.nn.init.uniform_()
relation_size_initializer_kwargs (
Optional
[Mapping
[str
,Any
]]) – Keyword arguments to be used when calling the relation matrix initializerkwargs – Remaining keyword arguments passed through to
pykeen.models.ERModel
.
This interaction relies on Abboud’s point-to-box distance
pykeen.utils.point_to_box_distance()
.Attributes Summary
The default strategy for optimizing the model's hyper-parameters
The default parameters for the default loss function class
Attributes Documentation