DistMultLiteral¶
-
class
DistMultLiteral
(triples_factory, embedding_dim=50, input_dropout=0.0, loss=None, preferred_device=None, random_seed=None)[source]¶ Bases:
pykeen.models.unimodal.distmult.DistMult
,pykeen.models.base.MultimodalModel
An implementation of DistMultLiteral from [kristiadi2018].
Initialize DistMult.
- Parameters
embedding_dim (
int
) – The entity embedding dimension \(d\). Is usually \(d \in [50, 300]\).entity_initializer – Default: xavier uniform, c.f. https://github.com/thunlp/OpenKE/blob/adeed2c0d2bef939807ed4f69c1ea4db35fd149b/models/DistMult.py#L16-L17
entity_constrainer – Default: constrain entity embeddings to unit length
relation_initializer – Default: relations are initialized to unit length (but not constrained)
Attributes Summary
The default strategy for optimizing the model’s hyper-parameters
The default parameters for the default loss function class
Methods Summary
forward
(h_indices, r_indices, t_indices)Defines the computation performed at every call.
Attributes Documentation
-
hpo_default
: ClassVar[Mapping[str, Any]] = {'embedding_dim': {'high': 256, 'low': 16, 'q': 16, 'type': <class 'int'>}, 'input_dropout': {'high': 0.5, 'low': 0.0, 'q': 0.1, 'type': <class 'float'>}}¶ The default strategy for optimizing the model’s hyper-parameters
-
loss_default_kwargs
: ClassVar[Mapping[str, Any]] = {'margin': 0.0}¶ The default parameters for the default loss function class
Methods Documentation
-
forward
(h_indices, r_indices, t_indices)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Return type
FloatTensor