generate_corruptions_for_fit

ampligraph.evaluation.generate_corruptions_for_fit(X, all_entities, eta=1, corrupt_side='s+o', rnd=None)

Generate corruptions for training.

Creates corrupted triples for each statement in an array of statements, as described by :[TWR+16].

Note

Collisions are not checked, as this will be computationally expensive [TWR+16]. That means that some corruptions may result in being positive statements (i.e. unfiltered settings).

Parameters:
  • X (Tensor, shape [n, 3]) – An array of positive triples that will be used to create corruptions.
  • all_entities (dict) – The entity-tointernal-IDs mappings
  • eta (int) – The number of corruptions per triple that must be generated.
  • rnd (numpy.random.RandomState) – A random number generator.
Returns:

out – An array of corruptions for a list of positive triples x. For each row in X the corresponding corruption indexes can be found at [index+i*n for i in range(eta)]

Return type:

Tensor, shape [n * eta, 3]