Skip to content
ReEnvision
← Unit 2: Data: what AI learns from

Collecting, labeling and splitting data

How raw information becomes a dataset a model can learn from, and why some of it must be kept hidden for testing.

Lesson 2.2 50 minNo coding required

Objectives

By the end of this lesson, you will be able to:

  • Describe the steps from raw data to a usable dataset
  • Explain why labels must be consistent, and what happens when they are not
  • Explain why data is split into training and test sets

Key terms

Labeling
Attaching the correct answer to each example, often done by people.
Training set
The examples a model learns from.
Test set
Examples kept hidden during training and used afterward to check how well the model works on new cases.

Reading

From raw information to a dataset

Raw data is messy. It has duplicates, blanks, typos and entries in different formats. Before a model can learn from it, someone has to clean it: remove obvious errors, make formats consistent, and decide what to do about missing values.

Then the examples need labels. Sometimes labels come for free, as when the sale price of a house is already on record. Often people must add them by hand, looking at each image or sentence and choosing the right answer. Much of the work behind AI is this careful, human labeling.

Why consistent labels matter

A model treats its labels as the truth. If two people label the same kind of example differently, the model receives mixed signals and learns a muddier pattern.

Good labeling projects therefore write clear guidelines, have more than one person label the same examples, and measure how often they agree. Where people disagree, the guideline is usually unclear, or the question has no single right answer. Both are worth knowing before a model is built.

Training and testing

Suppose a teacher handed out the exact exam questions as homework. High exam scores would show only that students memorized the answers. To find out whether they understood, the exam needs new questions.

Models are the same. We split the dataset in two. The model learns from the training set. The test set stays hidden until the end, then we check the model's answers against it. Good performance on the test set is evidence the model learned a real pattern rather than memorizing.

The test set must also resemble the real situations the model will face. Testing a speech model only on clear studio recordings says little about how it copes in a noisy market.

Try it · Interactive lab

Good practice or problem?

A team is preparing a dataset. Judge each thing they do.

Card 1 of 6Score 0

Two people label the same examples and compare answers

Build it in the AI StudioBuild a Kindness CoachSee labelled examples at work: train an AI on kind and unkind messages, then test it.

Group activity 20 min

The labeling challenge

You will need

  • Fifteen short written messages on cards, some clearly friendly, some clearly unfriendly, several ambiguous or sarcastic
  • A tally sheet
  1. 1

    Each person privately labels all fifteen messages as Friendly or Unfriendly. No discussion.

  2. 2

    Tally the results. Circle every message where the group did not fully agree.

  3. 3

    Together, write a short labeling guideline that would settle the circled cases. Do you need a third label such as Unclear?

  4. 4

    Finally, set aside five cards as a test set. Explain why a model should never see those five while learning.

Discuss

  1. Q1

    Which messages caused the most disagreement? What made them hard?

  2. Q2

    If a model learned from our first round of labels, what would it learn about the ambiguous messages?

  3. Q3

    Labeling can be repetitive work, and sometimes involves upsetting content. What do the people who do it deserve?

Write your answer to one of the questions. Saved only on this device.

Quick check

Choose an answer to see whether you were right, and why.

  1. 1Why is a test set kept hidden from the model during training?

  2. 2Two labelers often disagree on the same examples. What does this most likely mean?

  3. 3A speech model is tested only on clear studio recordings. What is the risk?

Key takeaways

  • Data must be cleaned and labeled before a model can learn from it.
  • Inconsistent labels teach a model a muddy pattern.
  • A hidden test set shows whether a model works on new cases.