Definition
What if half the labels in your examples were wrong?
Good data is accurate, complete, varied and relevant to the task. Bad data has problems such as too few examples, wrong labels, missing values, duplicates or a one-sided mix, and a model trained on it learns those problems.
In simple words
Engineers say "garbage in, garbage out". If you teach a model with photos where some cats are labelled dogs, it will learn the wrong thing. If all your dog photos are taken in sunshine, it may think 'sunny' means 'dog'. Checking the data is as important as building the model.
Why it matters
Most AI failures in the real world trace back to the data, not the model. Learning to spot data problems early saves time and prevents unfair or dangerous mistakes later.
Key terms
- Data quality
- How well data suits its purpose: accurate, complete, consistent, up to date and representative.
- Missing value
- A gap in the data where a value should be but was never recorded.
- Duplicate
- The same example appearing more than once.
- Outlier
- A value far from the rest, which may be a mistake or a genuine rare case.
- Data cleaning
- Finding and fixing errors, gaps and duplicates before data is used.
- Representative
- Containing the same mix of cases as the real situation the model will face.
Explained in detail
Garbage in, garbage out
Computer scientists have an old saying: garbage in, garbage out. A machine learning model has no knowledge of the world apart from its data. It cannot notice that a weight of 700 kilograms for a schoolchild is absurd, or that a photo labelled "cat" plainly shows a dog. Whatever is in the data, the model treats as truth and learns from it. For this reason the people who build AI systems commonly report spending more of their time preparing data than building models.
Six signs of good data
| Quality | Question to ask | Example of failure |
|---|---|---|
| Accurate | Are the values and labels correct? | A height entered as 1,700 cm |
| Complete | Is anything missing? | Half the patients have no age recorded |
| Consistent | Is the same thing always written the same way? | "Mumbai", "Bombay" and "mumbai" counted as three cities |
| Up to date | Does it describe the present? | Prices from five years ago |
| Relevant | Does it relate to the question? | Shoe sizes in a rainfall dataset |
| Representative | Does it cover every kind of case? | Only daytime photos for a camera used at night |
Common problems and what they do
Wrong labels teach the wrong lesson directly. Missing values force a choice: drop the example and lose data, or fill the gap with a guess and risk inventing a pattern. Duplicates make some examples count twice, and if a duplicate lands in both the training and the test set, the test score is inflated. Outliers need thought. An income a thousand times larger than the others may be a typing error, or it may be a real billionaire; removing genuine rare cases blinds the model to them. Too little data leaves the model guessing from coincidences.
Cleaning data
- Look at the data before using it. Sort each column and read the largest and smallest values.
- Remove exact duplicates.
- Make names and units consistent: one spelling for each city, one unit for each measurement.
- Decide what to do about each missing value, and write down what you decided.
- Check a sample of the labels by hand.
- Count the examples in each group to see whether any group is too small.
More is not always better
It is natural to think that a bigger dataset must be a better one. A million examples with careless labels can produce a worse model than ten thousand checked ones. A huge dataset drawn from one city does not teach a model about villages. Quantity helps only when quality and variety come with it. Experienced teams also write a short description of each dataset, recording where it came from, who is in it and who is missing, so that anyone who uses it later knows its limits.
How it works
| Problem | Example | What the model learns |
|---|---|---|
| Too little data | Only 5 photos of each animal | A weak, unreliable pattern |
| Wrong labels | Some cats marked as dogs | Confused answers |
| Missing values | Size left blank for many animals | Gaps in its knowledge |
| Duplicates | The same photo added ten times | Too much weight on one case |
| One-sided data | Only big dogs, never small ones | Mistakes on whatever is missing |
Try it yourself
Clean a messy dataset
A shop wants to predict sales. See what's wrong with its data before training.
Find the problems in a dataset
Each row comes from a dataset for a fruit-sorting model. What is wrong with it, if anything?
Orange, 155 g, bumpy skin. Label: apple
Red, 150 g, smooth skin. Label: orange
Row 7 is exactly the same as row 6
Green, 140 g, smooth skin. Label: apple
Orange, ___ g, bumpy skin. Label: orange
Common mistakes
- Assuming data is correct because a computer stored it.
- Collecting data only from what is easy to find.
- Fixing the model when the real problem is the data.
Check yourself
Summary
- Good data is accurate, complete, varied and relevant.
- Watch for wrong labels, missing values, duplicates and one-sided data.
- Most AI failures come from data problems.
Finished reading?
Sources: Google Machine Learning Crash Course