Book an info sessionInfo session

Training data and labels

AI Explorers · lesson 11 of 24 · 25 min

If you learned to cook only from pancake recipes, you’d be great at breakfast and lost at dinner. A machine learning model is only as good as the examples it learns from.

Training data

Training data is the set of examples a model learns from. It might be photos, sound clips, sentences, or rows in a table.

Good training data has three qualities:

  • Enough: more examples usually help a model learn the real pattern instead of a fluke.
  • Variety: examples should cover the different ways things show up in real life. Different lighting, angles, backgrounds, voices and people.
  • Accuracy: the examples should be correct and clear.

Labels

For many models, each example also needs a label, which is the correct answer. A photo of a basketball gets the label “basketball.” A sound clip of a dog gets the label “bark.”

Groups of examples with the same label are called classes. A model that sorts photos into “cat,” “dog” and “neither” has three classes. Sorting things into classes is called classification, and it is one of the most common jobs in AI.

Who makes labels? People. Sometimes a lot of people, labeling thousands of pictures one by one. That means labels can contain human mistakes and human opinions. Is a photo of a muffin “dessert” or “breakfast”? Different people might say different things.

When the data is off

Problems in training data turn into problems in the model. Here are some common ones:

ProblemExampleWhat goes wrong
Not enough varietyA “shoe” model trained only on sneakersIt fails on boots and sandals
Wrong labelsSome dog photos labeled “cat”The model gets confused
Hidden shortcutEvery “wolf” photo has snow in itThe model learns “snow means wolf”
Missing groupsA face model trained mostly on light-skinned facesIt works worse on darker-skinned faces

The “hidden shortcut” problem is sneaky. A model does not know what you meant to teach it. It learns whatever pattern most easily separates the classes, even a silly one like snow in the background.

Collecting good data takes real effort, and it is often the biggest part of an AI project. Teams spend a lot of time finding examples, cleaning up mistakes and checking that every group of people and situations is included. When you hear about a powerful AI system, remember that behind it is a mountain of data, and many people who gathered and labeled it.

Try it

Make a labeled dataset with real objects.

  1. Pick two classes of things you have at home, like “spoon” and “fork,” or “fruit” and “not fruit.”
  2. Collect at least 6 examples of each. If you can’t collect objects, draw them or list them.
  3. Lay them out in two groups and write a label card for each group.
  4. Now play detective. Look for a hidden shortcut: is every item in one class the same color, size or material? Write it down.
  5. Swap in at least two examples that break the shortcut, so the only real difference between the classes is the thing you care about.

Check yourself

What is a label in training data?

The correct answer attached to an example, like the word “basketball” on a basketball photo.

Give one quality of good training data.

Enough examples, lots of variety, or accurate labels.

What is a hidden shortcut?

An accidental pattern in the data, like snow behind every wolf photo, that the model learns instead of the real thing.

Key words

  • Training data: examples a model learns from.
  • Label: the correct answer attached to an example.
  • Class: a group of examples with the same label.
  • Classification: sorting inputs into classes.
  • Dataset: an organized collection of data.

Previous lesson: Learning from examples, not rules
Back to AI Explorers
Next lesson: Testing: is the model any good?