Checking for Duplicate Examples Across Splits

Repeated copies of one example can make held-out performance look stronger than use on genuinely new inputs.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace one import
  2. Choose groups when exact keys are insufficient
  3. Detect repeated entities as well as identical rows
  4. Record the rule for near duplicates

Trace one import

A redundant copy of the same labelled record can enter both training and test when rows are split independently. Detect shared source identity before computing scores. See duplicate observations.

Choose groups when exact keys are insufficient

Closely related observations can require a grouped split even if text differs. Holding out groups connects the policy to the intended prediction task.[1][2]

Detect repeated entities as well as identical rows

A report may appear in training as its first draft and in validation as a lightly edited revision. Comparing full bytes misses that relationship. Use stable document identity or justified grouping when the aim is evaluation on different documents. See holding out groups.

Training: report 42 revision 1
Validation: report 42 revision 2
Different bytes, same document group
Keep group on one side for unseen-document evaluation

Record the rule for near duplicates

Hashing bytes can find exact repeats. Normalized or domain-level comparisons can find meaningful variants, with a risk of merging distinct data. Audit examples of both.

References

  1. Gareth James et al., An Introduction to Statistical Learning ↩
  2. scikit-learn Developers, Metrics and Scoring: Quantifying the Quality of Predictions ↩