SLCWATrainingLoop

class SLCWATrainingLoop(model, triples_factory, optimizer=None, lr_scheduler=None, negative_sampler=None, negative_sampler_kwargs=None, automatic_memory_optimization=True)[source]

Bases: pykeen.training.training_loop.TrainingLoop[pykeen.triples.instances.SLCWASampleType, Tuple[torch.LongTensor, torch.LongTensor, Optional[torch.BoolTensor]]]

A training loop that uses the stochastic local closed world assumption training approach.

[ruffinelli2020] call the sLCWA NegSamp in their work.

Initialize the training loop.

Parameters
  • model (Model) – The model to train

  • triples_factory (CoreTriplesFactory) – The triples factory to train over

  • optimizer (Optional[Optimizer]) – The optimizer to use while training the model

  • lr_scheduler (Optional[_LRScheduler]) – The learning rate scheduler you want to use while training the model

  • negative_sampler (Union[str, NegativeSampler, Type[NegativeSampler], None]) – The class, instance, or name of the negative sampler

  • negative_sampler_kwargs (Optional[Mapping[str, Any]]) – Keyword arguments to pass to the negative sampler class on instantiation for every positive one

  • automatic_memory_optimization (bool) – Whether to automatically optimize the sub-batch size during training and batch size during evaluation with regards to the hardware at hand.

Attributes Summary

loss_blacklist

Attributes Documentation

loss_blacklist: ClassVar[Optional[List[Type[Loss]]]] = [<class 'pykeen.losses.CrossEntropyLoss'>]