LiteralModel

class LiteralModel(triples_factory, interaction, entity_representations, relation_representations=None, **kwargs)[source]

Bases: pykeen.models.nbase.ERModel[pykeen.typing.HeadRepresentation, pykeen.typing.RelationRepresentation, pykeen.typing.TailRepresentation]

Base class for models with entity literals that uses combinations from pykeen.nn.combinations.

Initialize the module.

Parameters
  • triples_factory (TriplesNumericLiteralsFactory) – The triples factory facilitates access to the dataset.

  • interaction (LiteralInteraction) – The interaction module (e.g., TransE)

  • interaction_kwargs – Additional key-word based parameters given to the interaction module’s constructor, if not already instantiated.

  • entity_representations (Sequence[Union[EmbeddingSpecification, RepresentationModule]]) – The entity representation or sequence of representations

  • relation_representations (Union[None, EmbeddingSpecification, RepresentationModule, Sequence[Union[EmbeddingSpecification, RepresentationModule]]]) – The relation representation or sequence of representations

  • loss – The loss to use. If None is given, use the loss default specific to the model subclass.

  • loss_kwargs – Additional key-word based parameters given to the loss module’s constructor, if not already instantiated.

  • predict_with_sigmoid – Whether to apply sigmoid onto the scores when predicting scores. Applying sigmoid at prediction time may lead to exactly equal scores for certain triples with very high, or very low score. When not trained with applying sigmoid (or using BCEWithLogitsLoss), the scores are not calibrated to perform well with sigmoid.

  • preferred_device – The preferred device for model training and inference.

  • random_seed – A random seed to use for initialising the model’s weights. Should be set when aiming at reproducibility.

  • skip_checks – whether to skip entity representation checks.