- class InductiveNodePiece(*, triples_factory, inference_factory, num_tokens=2, embedding_dim=64, relation_representations_kwargs=None, interaction=<class 'pykeen.nn.modules.DistMultInteraction'>, aggregation=None, validation_factory=None, test_factory=None, **kwargs)
A wrapper which combines an interaction function with NodePiece entity representations from [galkin2021].
This model uses the
pykeen.nn.NodePieceRepresentationinstead of a typical
pykeen.nn.Embeddingto more efficiently store representations.
Initialize the model.
CoreTriplesFactory) – the triples factory of training triples. Must have create_inverse_triples set to True.
CoreTriplesFactory) – the triples factory of inference triples. Must have create_inverse_triples set to True.
int) – the number of relations to use to represent each entity, cf.
int) – the embedding dimension. Only used if embedding_specification is not given.
aggregation of multiple token representations to a single entity representation. By default, this uses
torch.mean(). If a string is provided, the module assumes that this refers to a top-level torch function, e.g. “mean” for
torch.mean(), or “sum” for func:torch.sum. An aggregation can also have trainable parameters, .e.g.,
MLP(mean(MLP(tokens)))(cf. DeepSets from [zaheer2017]). In this case, the module has to be created outside of this component.
Moreover, we support providing “mlp” as a shortcut to use the MLP aggregation version from [galkin2021].
We could also have aggregations which result in differently shapes output, e.g. a concatenation of all token embeddings resulting in shape
(num_tokens * d,). In this case, shape must be provided.
The aggregation takes two arguments: the (batched) tensor of token representations, in shape
(*, num_tokens, *dt), and the index along which to aggregate.
kwargs – additional keyword-based arguments passed to
ValueError – if the triples factory does not create inverse triples
The default strategy for optimizing the model's hyper-parameters