GatedCombination
- class GatedCombination(entity_embedding_dim, literal_embedding_dim, input_dropout=0.0, gate_activation=<class 'torch.nn.modules.activation.Sigmoid'>, gate_activation_kwargs=None, linlayer_activation=<class 'torch.nn.modules.activation.Tanh'>, linlayer_activation_kwargs=None)[source]
Bases:
pykeen.nn.combinations.Combination
A module that implements a gated linear transformation for the combination of entities and literals.
Compared to the other Combinations, this combination makes use of a gating mechanism commonly found in RNNs. The main goal of this gating mechanism is to learn which parts of the additional literal information is useful or not and act accordingly, by incorporating them into the new combined embedding or discarding them.
Implementation based on https://github.com/SmartDataAnalytics/LiteralE/blob/master/model.py Gate class.
Instantiate the
torch.nn.Module
.- Parameters
entity_embedding_dim (
int
) – The dimension of the entity representations.literal_embedding_dim (
int
) – The dimension of the literals.gate_activation (
Union
[str
,Module
,Type
[Module
],None
]) – An optional, pre-instantiated activation module, liketorch.nn.Sigmoid
, used on the gate output.linlayer_activation_kwargs (
Optional
[Mapping
[str
,Any
]]) – An optional, pre-instantiated activation module, liketorch.nn.Tanh
, used on the linear layer output.
Methods Summary
forward
(x, literal)Calculate a combined embedding given the entity and literal representations.
Methods Documentation