Training data is the collection of examples used to teach a machine learning model. Each example contains features (inputs) and labels (correct outputs).
Features — Email text, Sender, Subject, Links
Label — Spam or Not Spam
The model learns patterns that distinguish spam from non-spam emails.
Good Training Data → Better Model → Better Predictions
Poor Training Data → Weaker Model → Poor Predictions
A model can only learn what its training data teaches it.
Features — House size, Bedrooms, Location, Year built
Label — Sale price
The model learns the relationship between features and the sale price.
Image recognition — Images labeled as cat, dog, or car
Spam detection — Emails labeled as spam or not spam
House prices — Listings with actual sale prices
Customer data with no predefined groups — the model discovers clusters on its own
Game AI receives a reward for winning and a penalty for losing — learns through trial and error
Correct features and correct labels.
Incorrect example — Email labeled as "not spam" that is actually spam
All important features should be present.
Problem — House price dataset missing location for half the records
Relevant for exam score — Study hours, attendance, prior grades
Irrelevant — Student's favorite color, random ID
A voice assistant trained mostly on adult voices may struggle with children's voices.
Training data should reflect all groups and situations the model will encounter.
Too little — 10 dog photos per breed → poor generalization
Better — Thousands of photos per breed → much better performance
Training accuracy: 99%
Test accuracy: 70%
The model memorized training data rather than learning generalizable patterns.
Using only house size to predict price — ignoring location, bedrooms, and condition.
The model fails to capture the actual complexity of the relationship.
Train on 100% of data → Test on the same 100%
The model appears to work perfectly, but this is misleading because it has seen all the answers.
Train on 70–80% → Test on 20–30%
The test set represents new unseen data. This measures real generalization.
Collect raw data
Clean and fix problems
Engineer useful features
Encode and scale features
Split into train/validation/test sets
Train the model on the training set
| Dataset | Typical Size | Purpose |
|---|---|---|
| Training | 70–80% | Used to teach the model |
| Validation | 10–15% | Used to tune and improve the model |
| Test | 10–20% | Used to evaluate final performance |
Non-fraud: 99% / Fraud: 1%
A model predicting "not fraud" every time achieves 99% accuracy but detects 0% of fraud.
Features — Patient age, Symptoms, Lab results, Medical history
Label — Diagnosis
Key requirements — Accurate expert labels, diverse demographics, sufficient examples for rare conditions
Inputs — Camera images, LIDAR readings, GPS, Weather
Labels — Object positions (cars, pedestrians, signs), Correct driving actions
Must include data from various road conditions, weather, and locations to generalize well.
Ask the AI if you need help understanding training data, how to identify good versus bad training data, class imbalance, or the importance of data splitting.