generate_corruptions_for_eval

ampligraph.evaluation.generate_corruptions_for_eval(X, entities_for_corruption, corrupt_side='s+o', table_entity_lookup_left=None, table_entity_lookup_right=None, table_reln_lookup=None)

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
  • table_entity_lookup_left (tf.HashTable) – Hash table of subject entities mapped to unique prime numbers
  • table_entity_lookup_right (tf.HashTable) – Hash table of object entities mapped to unique prime numbers
  • table_reln_lookup (tf.HashTable) – Hash table of relations mapped to unique prime numbers
Returns:

  • out (Tensor, shape [n, 3]) – An array of corruptions for the triples for x.
  • out_prime (Tensor, shape [n, 3]) – An array of product of prime numbers associated with corruption triples or None based on filtered or non filtered version.