Course 2, lesson 12 of 100, Ages 6+
Rules or learning?
Two ways to make computers smart
Like I’m 5
You can tell a computer exactly what to do, step by step. That's rules. Or you can show it lots of examples and let it learn. That's AI.
The big idea
With rules, a programmer writes every instruction: 'if the room is colder than 18 degrees, turn on the heater'. Rules are clear and predictable, but someone has to think of every situation.
Some jobs are too messy for rules. Try writing rules for spotting a cat in any photo: sitting, sleeping, in the dark, half hidden. It's nearly impossible. So we show the computer thousands of cat photos and let it learn the pattern.
Examples
- Calculator: Rules work perfectly: 2 + 2 is always 4.
- Traffic lights: Simple rules: green, amber, red, repeat.
- Reading handwriting: Everyone writes differently, so learning from examples works better than rules.
How it works
- Decide whether the job has clear, fixed steps.
- If it does, write rules. If it's messy, collect examples.
- Use the examples to train an AI that learns the pattern.
Check your understanding
- Which job is easiest to solve with simple rules?
- Options: Adding two numbers; Recognising a friend's face in any photo; Understanding every accent.
Answer: Adding two numbers. Adding has exact steps. Faces and voices vary too much for simple rules. - Why use learning instead of rules to spot cats?
- Options: Cats look different in every photo, so rules can't cover them all; Rules are against the law; Computers can't follow rules.
Answer: Cats look different in every photo, so rules can't cover them all. Learning from many examples copes with all that variety.
Remember
Rules work for clear, fixed jobs. Learning from examples works for messy, varied jobs.
Talk about it
Can you think of a job with clear rules, and one that's too messy for rules?
Go deeper
Rule-based programs called expert systems were popular in the 1980s. Machine learning replaced them for tasks like vision and speech, but rules are still used alongside AI for safety checks and business logic.