Cleaning, Labeling & Preparing Data
You'll learn to
- -Understand the common data cleaning steps that happen before training
- -Recognize why this unglamorous work consumes so much practitioner time
Raw data is almost never ready to train on directly. It is famously said that data scientists and ML engineers spend a large majority of their time on cleaning and preparation, not on the modeling itself, and that reputation is well earned.
What "Cleaning" Actually Involves
- -Handling missing values means deciding whether to fill them in with a reasonable estimate, discard the incomplete example, or leave a gap the model can learn to handle.
- -Removing duplicates and near-duplicates matters because repeated examples can quietly bias a model toward whatever happens to be over-represented.
- -Fixing inconsistent formats is necessary because the same underlying value written multiple different ways, dates, units, capitalization, needs to be standardized before it can be compared meaningfully.
- -Filtering out low-quality or irrelevant examples matters too. Not every collected example is actually useful, and including junk can hurt more than help.
Labeling: Turning Raw Data Into Supervised Examples
For supervised learning specifically, someone or something has to attach the correct label to each example. This can mean human annotators reviewing examples one by one, using labels a product already naturally produces (a purchase is itself evidence a recommendation worked), or, as covered earlier, the self-supervised trick of generating labels automatically from the data's own structure.
A useful rule of thumb: the quality ceiling of a model is set by the quality of its data, not by the sophistication of the algorithm. A powerful algorithm trained on messy, mislabeled data will reliably lose to a simple algorithm trained on clean, well-labeled data.
Feature Engineering
Especially for classical ML, less so for deep learning which often learns useful representations directly from raw data, practitioners frequently transform raw data into more useful features before training. Turning a raw timestamp into "day of week" and "hour of day" is a classic example, since those derived values are often more directly predictive than the raw timestamp itself.
In practice, this entire chapter is what the pandas library exists for. Reading messy CSVs or database exports into a DataFrame, then using methods like .dropna(), .fillna(), .drop_duplicates(), and .apply() does exactly the cleaning and feature engineering described here, instead of hand-rolling loops over raw Python lists.
Interview Signal is part of Pro
See a real weak answer next to a real strong one for this exact topic.
Quiz is part of Pro
Test what you just read with a short quiz, and bank the XP.