Data cleaning is the unglamorous work of making a dataset correct before anything learns from it. Rahm and Do define it as detecting and removing errors and inconsistencies to improve data quality. A model trained on dirty data learns the dirt along with the signal, and no amount of modelling downstream fully undoes it.
What goes wrong
- Duplicates: the same record entered twice, or the same customer spelled two ways. Duplicates that land in both training and test sets inflate scores, a form of data leakage.
- Missing values: blank fields that must be filled in, flagged, or dropped, each choice with its own bias.
- Invalid or inconsistent values: typos, impossible ages, dates in three formats, the same unit recorded as metres in one table and feet in another.
- Outliers: some are errors, some are the most important rows in the data. Anomaly detection can flag them; a person usually has to decide which is which.
- Wrong labels: for supervised learning, the answers themselves can be wrong.
Problems multiply when data is merged from several sources, which rarely agree on formats or conventions; Rahm and Do note that integrating sources sharply increases the need for cleaning.
Labels count too
Label errors are easy to overlook because they look like data. Northcutt and colleagues estimated an average of at least 3.3% label errors across the test sets of ten widely used benchmarks, including at least 6% of the ImageNet validation set. Errors at that level can change which model looks best.
In practice
Cleaning overlaps with data preprocessing but comes first: fix what is wrong before you transform what is right. Write the rules down as code so they can be rerun and reviewed, keep the raw data untouched, and version the cleaned copy, because cleaning decisions shape results as much as model choices do.