Skip to content
ML Academy

Classical ML, validation, metrics, interpretation, debugging · insight-0163

Deduplicate at the correct grain before splitting so copies do not straddle train and test

Evidence type
documented fact
Difficulty
easy
Roles
Data scientist, Data analyst, ML engineer
Industries
aviation, cross-industry

Summary: situation, action, reason, boundary

  1. Situation

    The raw table has exact or near-duplicate rows, for example re-sent records or late updates of the same event.

  2. Action

    Define the business key, resolve duplicates (keep the latest valid version) before splitting, and check after splitting that no key appears in both sets.

  3. Reason

    Duplicates across the boundary turn generalization tests into recall tests.

  4. Boundary

    Event logs, CRM exports, scraped data, image or text corpora and any data merged from several systems.

Symptom or risk

A row and its copy land on both sides of the split; the model is scored on memorized examples and validation is inflated.

Exceptions

Repeated identical feature vectors with different labels are genuine noise, not duplicates; keep them but note them.

Trade-offs

Near-duplicate detection can be expensive; start with exact keys and the highest-risk sources.

Pitfalls

Deduplicating on all columns, which misses copies that differ only by an updated revenue field.

Example

Synthetic flight_day_raw: about 0.8% duplicate rows, half with a late revenue update, so key on flight_no and date.

Lessons and concepts

Claims and their sources