B2 · How Artificial Intelligence Works: Data and Learning

Training a Model

Training a model means showing it many labelled examples so that it can find a pattern linking the features to the labels. A model is the result of training: the learned pattern, ready to make predictions about new cases.

12 min Beginner Jump to the activity

What you need: Nothing. This page starts from the beginning, with no programming and no formulas.

Definition

Can you teach a computer to tell cats from dogs in two minutes?

Training a model means showing it many labelled examples so that it can find a pattern linking the features to the labels. A model is the result of training: the learned pattern, ready to make predictions about new cases.

In simple words

In the activity, every animal has two clues: its size and how long its snout is. You choose which labelled examples the model learns from. When it meets a new animal, it looks for the three examples most like it and goes with the majority. The examples you choose are all it knows.

Why it matters

Training is where a model gets all of its knowledge. If the training examples are too few, one-sided or wrongly labelled, the model will be wrong in exactly those ways. Whoever chooses the training data shapes the AI.

How it works

  1. Choose the task: tell cats from dogs.
  2. Choose the features: size and snout length.
  3. Collect labelled examples of both kinds.
  4. Let the model learn from them.
  5. Test it on animals it has never seen.

Try it yourself

Train a model in the browser

Add labelled examples, then test the model on new animals. Try a few examples first, then more.

Common mistakes

  • Training with examples of only one kind.
  • Using too few examples and expecting perfect results.
  • Thinking the model understands animals. It only compares numbers for size and snout.

Check yourself

Question 1

1. What is a trained model?

Question 2

2. You trained only on big dogs. What will the model likely say about a tiny dog?

Question 3

3. Where does a model get its knowledge?

Summary

  • Training means learning a pattern from labelled examples.
  • The trained model is the learned pattern, used on new cases.
  • The training examples decide what the model knows and gets wrong.

Finished reading?

Sources: Google Machine Learning Crash Course