generate_corruptions_for_eval

ampligraph.evaluation.generate_corruptions_for_eval(X, entities_for_corruption, corrupt_side='s, o')

Generate corruptions for evaluation.

Create corruptions (subject and object) for a given triple x, in compliance with the local closed world assumption (LCWA), as described in [NMTG16].

Parameters
  • X (Tensor, shape [1, 3]) – Currently, a single positive triples that will be used to create corruptions.

  • entities_for_corruption (Tensor) – All the entity IDs which are to be used for generation of corruptions.

  • corrupt_side (string) –

    Specifies which side of the triple to corrupt:

    • ’s’: corrupt only subject.

    • ’o’: corrupt only object

    • ’s+o’: corrupt both subject and object

    • ’s,o’: corrupt both subject and object but ranks are computed separately.

Returns

out – An array of corruptions for the triples for x.

Return type

Tensor, shape [n, 3]