Tools for removing the leakage from datasets.
Leakage is when the inverse of a given training triple appears in either the testing or validation set. This scenario generally leads to inflated and misleading evaluation because predicting an inverse triple is usually very easy and not a sign of the generalizability of a model to predict novel triples.
Sealant(triples_factory, minimum_frequency=None, symmetric=True)¶
Stores inverse frequencies and inverse mappings in a given triples factory.
Index the inverse frequencies and the inverse relations in the triples factory.
TriplesFactory) – The triples factory to index.
float]) – The minimum overlap between two relations’ triples to consider them as inverses. The default value, 0.97, is taken from Toutanova and Chen (2015), who originally described the generation of FB15k-237.
Make a new triples factory containing neither duplicate nor inverse relationships.
- Return type
unleak(train, *triples_factories, n=None, minimum_frequency=None)¶
Unleak a train, test, and validate triples factory.
TriplesFactory) – The target triples factory
TriplesFactory) – All other triples factories (test, validate, etc.)
The minimum overlap between two relations’ triples to consider them as inverses or duplicates. The default value, 0.97, is taken from Toutanova and Chen (2015), who originally described the generation of FB15k-237.
- Return type