What is machine learning?
Computers that learn from examples and experience, instead of following instructions step by step. The big idea in plain words.
Your phone suggests the next word as you type. Your email hides spam. A video app guesses what you will want to watch next. Nobody sat down and wrote a rule for each of these. The computer learned how to do them. That is machine learning.
This lesson is easier if you know a little about how computers work. If bits, programs and data are new to you, start with the How computers work path first. It takes about 50 minutes.
Instructions versus learning
Most computer programs follow instructions that a person wrote, step by step. A calculator is like that. It adds numbers exactly the way it was told to.
But some jobs are too tricky to write instructions for. Try describing exactly how to tell a cat from a dog in a photo. Which pixels? What shapes? You would never finish, and there would always be a cat that breaks your rules.
Machine learning turns the problem around:
Instead of writing the rules, show the computer lots of examples (or let it practise), and let it work out the rules itself.
What does "learning" mean for a computer?
A learning program has a few simple parts:
- Experience. Examples to look at, or a world to practise in.
- A model. A machine with lots of adjustable numbers, a bit like dials. At the start, the dials are set at random, so it is no good at all.
- A score. A way to tell whether an answer or a move was good or bad.
- Practice. The computer tries, checks its score, and turns the dials a tiny bit to do better. Then it does that thousands or millions of times.
That is all learning is: nudging numbers so the score goes up. The computer does not understand cats or mazes the way you do. It has just found numbers that work.
Three ways to learn
1. From examples. Show the computer many pictures, each with a label ("apple", "banana"). It works out what apples tend to look like, and can then label new pictures. This is how photo apps and spam filters learn. It is called supervised learning, because the examples come with answers.
2. From rewards. The computer tries things and gets points when it does well. Over time it finds out which choices lead to more points. This is how programs learn to play games, and how some robots learn to walk. It is called reinforcement learning.
3. From patterns. The computer gets a pile of things with no labels and finds groups of similar ones by itself. Shops use this to spot kinds of customers. It is called unsupervised learning.
Try it: learn from rewards
In Train the Puppy, you meet the second way. A virtual puppy knows nothing about its maze. You set the rewards, and it learns the route by trial and error, using a real learning algorithm.
Machine learning is not magic
A learning program does exactly what its examples or rewards teach it, and nothing more:
- If the examples are poor or unfair, the answers will be poor or unfair. People say garbage in, garbage out.
- If the reward is badly chosen, the computer may find a sneaky way to score points without doing what you wanted. You will see this happen in the game.
- A learner can only be as good as the practice it gets.
That is why people who build AI spend so much time on the data and the rewards, not just on the code.
Translation apps, voice assistants, photo searches, fraud alerts at banks, medical scans that help doctors spot problems, and the computer players in video games all use some kind of machine learning.
Words to know
- Machine learning
- Computers finding rules from examples or experience, instead of being told the rules.
- Model
- The part of a learning program with adjustable numbers that makes the guesses.
- Training
- Practising over and over, adjusting the numbers to get a better score.
- Supervised learning
- Learning from examples that come with the right answers.
- Reinforcement learning
- Learning by trial and error, from rewards and penalties.
- Unsupervised learning
- Finding groups and patterns in things that have no labels.
Check yourself
What is the main difference between normal programming and machine learning?
Show the answer
In normal programming a person writes the rules. In machine learning the computer works out the rules itself from examples or practice.
In one sentence, what is "training"?
Show the answer
Practising many times and nudging the numbers in the model so that the score gets better.
A computer is shown pictures with labels, like "cat" and "dog". Which kind of learning is that?
Show the answer
Supervised learning, because the examples come with answers.
Why can a learning program give unfair answers?
Show the answer
It learns from its examples or rewards. If they are unfair or poorly chosen, what it learns will be too.