How does AI learn? Data, patterns and mistakes
Traditional programs follow rules a person wrote: if the temperature is above 30, turn on the fan. Machine learning flips this around. Instead of writing the rules, we show the computer lots of examples and let it work out the rules itself.
Training, step by step
Say we want an AI that tells mangoes from bananas in photos.
- Collect data: thousands of photos, each labelled “mango” or “banana”.
- Guess: the untrained model looks at a photo and makes a (bad) guess.
- Check: we compare the guess with the correct label.
- Adjust: the model nudges its internal numbers (called parameters or weights) to be a little less wrong next time.
- Repeat millions of times.
After training, the model has learned patterns: the colours, shapes and textures that usually mean “mango”. That pattern-knowledge is called a model.
Testing: has it really learned?
We always keep some labelled photos hidden during training. Afterwards we test the model on them. If it does well on photos it has never seen, it learned real patterns. If it only does well on the training photos, it just memorised them. That’s called overfitting, like a student who memorises answers without understanding the chapter.
Garbage in, garbage out
A model only knows what its data shows it.
- If every mango photo was taken in bright sunlight, the model might fail on a mango in a dim kitchen.
- If a face-recognition system was trained mostly on one group of people, it can work worse for everyone else. This is called bias, and it has caused real harm.
So when you hear “the AI decided”, remember that people chose the data, and the data shaped the decision.
Try it yourself
Teachable Machine lets you train your own image model in the browser in about five minutes. Train it on two hand signs, then try to confuse it with a new background. You’ll see overfitting and bias happen in front of you.
Check yourself
What is the key difference between machine learning and a traditional program?
Why do we hide some data from the model during training?
A model scores 99% on its training photos but 60% on new photos. What's this called?
A hiring AI was trained mostly on past hires from one group. What's the likely risk?
Go deeper
- Video But what is a neural network? ↗ · 3Blue1Brown
- Free course Elements of AI: a free online course ↗ · University of Helsinki
More for you: 🎒 Students · 🧑🏫 Parents and teachers · 🧭 Job seekers