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.
- class 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.
CoreTriplesFactory) – 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.
Reindex a set of triples factories.
- unleak(train, *triples_factories, n=None, minimum_frequency=None)¶
Unleak a train, test, and validate triples factory.
CoreTriplesFactory) – The target triples factory
CoreTriplesFactory) – 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