Data Quality, Splits, and Leakage
The dataset defines what learning can discover
For ticket routing, each example includes input text and a category label. Decide what the label means before collecting data. If two reviewers disagree about whether a cancellation request is billing or account, a model cannot repair the missing policy definition.
Inspect missing values, duplicates, contradictory labels, class balance, languages, date ranges, and whether the examples represent future users. Distinguish selection bias in which examples are collected from label bias in how outcomes are assigned. A historical “successful resolution” label may reflect earlier staffing decisions rather than actual customer satisfaction.
Three splits, three different jobs
- Training: fit parameters and preprocessing statistics.
- Validation: compare configurations and choose thresholds.
- Test: estimate final performance after choices are fixed.
Repeatedly selecting models based on test results turns the test set into another validation set. Create a fresh holdout when that happens. Split proportions are context dependent; 80/10/10 is an example, not a requirement.
flowchart TD A[Raw records] --> B[Choose deployment-like split] B --> C[Train: fit transformations and model] B --> D[Validation: choose configuration] B --> E[Test: final measurement] C --> D D --> E
Leakage is information you would not have at prediction time
Suppose tickets contain an internal note: “Agent resolved as billing.” Including that note makes classification look easy, but it is written after routing. That is target leakage.
If a customer writes ten nearly identical tickets, random row splitting can place nine in training and one in test. The test then rewards memorization. Split by customer or conversation when deployment requires generalizing to new ones. For predicting future ticket volume, use chronological splits so tomorrow's information does not teach yesterday's prediction.
Fit vocabularies, scaling, and imputation only on the training split. Apply the saved transformations to validation and test. Deduplication across splits needs thoughtful handling: exact and near duplicates can inflate results.
Exercise with answer
Your model predicts whether a customer will cancel. Features include cancellation date, account age, and messages written before prediction time. Which is leakage? Answer: cancellation date, because it reveals the future target. Account age and prior messages may be valid if timestamped correctly and authorized for the purpose.
What should a dataset record include? A stable identifier, provenance, relevant timestamps, label definition, and permitted use. Versioning those records lets you reproduce a result and remove invalid examples later.