AI for young mindsBeginnerLesson 783 min read

How a computer learns from examples

AI doesn't learn like you do from a teacher's rules. It finds patterns in lots of examples. Try being the AI yourself!

Lesson in motion

In 60 seconds

How a computer learns from examples

AI doesn't learn like you do from a teacher's rules. It finds patterns in lots of examples. Try being the AI yourself!

1/4
In simple words
How did you learn which mangoes are ripe? Nobody gave you a rulebook. You saw lots of mangoes, touched them, smelled them, and your brain found the pattern. AI learns in a similar way, from examples.
Old computer programs followed rules that people wrote, step by step. Many AI systems work differently: people give them lots of examples with the right answers, and the computer finds the pattern by itself. This is called machine learning.

Two stages

StageWhat happensMango example
Training (learning)The computer sees many labelled examples and finds a patternThousands of mango photos marked "ripe" or "not ripe"
UsingIt uses the pattern on something newYou show a new mango photo, it guesses "ripe"
Your email app may do the same with spam: it learned from many messages marked "spam" or "not spam", and now it guesses for new messages.

Why variety matters

If the computer only saw yellow Alphonso mangoes, it might think every green mango is unripe, even if some green kinds are ripe! More varied examples (different kinds, colours, lighting, angles) help it learn the real pattern, not a shortcut.
Weak examples
  • Only one kind of mango
  • All photos in bright sunlight
  • Just a few examples
Strong examples
  • Many kinds of mangoes
  • Photos in different light and places
  • Lots of examples, checked carefully
Note
AI finds patterns, but it doesn't "understand" mangoes like you do. It can't taste or smell them. It can be tricked by things it never saw in training.
Be the AI! In the lab, you will learn a secret rule only from examples, just like a computer does.

Watch and read more

Lab

An unplugged "Be the AI" game where you learn a secret rule from picture cards.

~15 min

The problem

Play with a parent, sibling, friend or class. No screen needed.

  1. Teacher: draw 10 simple picture cards (fruits, animals, shapes). Secretly choose a rule, like "things that are round" or "things that can fly".
  2. Show the cards one by one to the "AI" player, saying "YES" or "NO" for each. This is training.
  3. Now show 5 new cards without saying anything. The AI player guesses YES or NO. This is using.
  4. Count correct guesses, then reveal the rule.
  5. Play again with a trickier rule. Did more varied cards help?

You are done when

Hard questions

Try to answer before you reveal. If you can answer these, you understood the lesson.

Q1In the game, the AI player guessed "yes" for everything red. What went wrong?Reveal

Maybe many of the training "yes" cards happened to be red, so the player learned a shortcut: "red means yes". The real rule was something else. Real AI can make the same mistake when examples aren't varied enough.

Q2Why test the AI on new cards, not the same ones used in training?Reveal

Getting the training cards right might just mean remembering them. Testing on new cards shows whether the player really learned the pattern. Real AI builders do the same: they test on examples the AI has never seen.

Please sign in to continue.

Questions people ask

Who gives AI its examples?

People and companies collect them: photos, text, sounds and more. Sometimes people label them by hand, like marking photos "ripe" or "not ripe".

Does AI keep learning while I use it?

Some systems are updated later with new examples, but many don't change while you use them. Learning usually happens in the training stage.

Is this how chatbots learn too?

In a similar way. Chatbots learn patterns from huge amounts of text, which helps them guess good next words. That's also why they can sound right and still be wrong.

Lesson test

5 questions. Get 3 right (60%) to pass and complete this lesson.

Sign in to take the test and save your progress