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, rnd=None)

Generate corruptions for evaluation.

Create all possible corruptions (subject and object) for a given triple x, in compliance with the LCWA.
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 to corrupt the entities. s is to corrupt only subject. o is to corrupt only object s+o is to 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
  • rnd (numpy.random.RandomState) – A random number generator.
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.