# SymmetricLCWATrainingLoop

class SymmetricLCWATrainingLoop(model, triples_factory, optimizer=None, optimizer_kwargs=None, lr_scheduler=None, lr_scheduler_kwargs=None, automatic_memory_optimization=True, mode=None, result_tracker=None, result_tracker_kwargs=None)[source]

Bases: TrainingLoop[Tuple[LongTensor], Tuple[LongTensor]]

A “symmetric” LCWA scoring heads and tails at once.

This objective was introduced by [lacroix2018] as

$l_{i,j,k}(X) = - X_{i,j,k} + \log \left( \sum_{k'} \exp(X_{i,j,k′}) \right) - X_{k,j+P,i} + \log \left( \sum_{i'} \exp (X_{k, j+P, i'}) \right)$

which can be seen as a “symmetric LCWA”, where for one batch of triples, we score both, heads and tails, given the remainder of the triple.

Note

at the same time, there is a also a difference to the LCWATrainingLoop: we do not group by e.g., head+relation pairs. Thus, the name might be suboptimal and change in the future.

Initialize the training loop.

Parameters