How data is used to train AI

To train a model, a dataset is split into three parts: a training set to learn from, a validation set to tune and compare models, and a test set kept aside for a final, honest check. Each row has features (the inputs) and, for supervised learning, a label (the answer).

Everyday analogy

Preparing for board exams: practice papers to learn (training), mock tests to see what to improve (validation), and the real exam you've never seen (test).

Example

Predicting delivery time. Features: distance, time of day, rain or not, restaurant preparation time. Label: the actual delivery time in minutes. The model learns from thousands of past orders, then predicts for new ones.

How a dataset is splitTraining set70%Validation set15%Test set15%
A common split: learn from 70%, tune on 15%, and keep 15% hidden for the final test.

A typical split of 10,000 past orders

Training · 70%7,000 orders to learn from
Validation · 15%1,500 to tune
Test · 15%1,500 for the final check

Feature engineering

Turning raw data into more useful features. For example, from an order date you can create "day of the week", "is it a festival?" and "is it month-end?", which often predict demand far better than the raw date.

Watch out: data leakage

If information from the test set, or from the future, sneaks into training, the model looks brilliant in testing and then fails in real life. Like seeing the exam paper the night before.

Try it yourself

About 10 min

Split the data

  1. Make a list of 20 numbered rows in a spreadsheet.
  2. Assign about 14 to training, 3 to validation and 3 to testing (shuffle first).
  3. Write why the test rows must stay hidden until the end.

What you should see: Keeping test data separate is how you honestly measure a model.

Use any free AI chatbot (ChatGPT, Claude, Gemini or Copilot). Never paste private or confidential information.

Build it for real · guided projectYour first machine learning model: predict house pricesAbout 75 min · Copy-paste code · step by step
Test what you learned

Take a quick quiz, or look up any word in the glossary.