CorruptionGenerationLayerTrain

class ampligraph.latent_features.layers.corruption_generation.CorruptionGenerationLayerTrain(*args: Any, **kwargs: Any)

Generates corruptions during training.

The corruption might involve either subject or object using entities sampled uniformly at random from the loaded graph.

Attributes

Methods

__init__([seed])

Initializes the corruption generation layer.

call(pos, ent_size, eta)

Generates corruption for the positives supplied.

get_config()

__init__(seed=0, **kwargs)

Initializes the corruption generation layer.

Parameters

eta (int) – Number of corruptions to generate.

call(pos, ent_size, eta)

Generates corruption for the positives supplied.

Parameters
  • pos (array-like, shape (n, 3)) – Batch of input triples (positives).

  • ent_size (int) – Number of unique entities present in the partition.

Returns

corruptions – Corruptions of the triples.

Return type

array-like, shape (n * eta, 3)

get_config()