Chapter 4
Many knobs
So far the rule has looked at one thing: time. Real answers depend on many things at once. This chapter lets the rule look at several things, and gives it one knob for each.
- Build a rule that looks at several things at once.
- Read a knob: its size says how much a thing matters, and its sign says which way it pushes.
- Explain how a machine learns to ignore something useless.
- Tell the two kinds of number apart: the things going in, and the knobs.
- Spot the pattern inside every machine in this article: multiply each thing by its knob, then add.
One thing is not enough
Our rider is planning bike rides, and wants to know how long each one will take. A good first guess: longer rides take longer. So let the rule look at the distance.
We do not need to set the knob by hand any more. The machine from chapter 3 has done it. Here is its best line.
The best line still misses by up to 21 minutes. Look at the two rides of 20 km. Same distance, but one took 18 minutes longer. Distance alone cannot explain that.
In chapter 2 the misses were small, and came from a shaky hand on the stopwatch. These misses are different. They are big, and they have a cause. The rule is missing something it needs to look at.
No knob setting can fix that. The rule has one knob, on distance. It has nowhere to put what it knows about hills.
A knob for each thing
The fix is simple. Let the rule look at two things, and give each its own knob. One knob says how many minutes each kilometre costs. The other says how many minutes each hill costs.
Think of a sound mixing desk. Each instrument has its own knob, and the knob sets how much of that instrument goes into the song. Here, each knob sets how much of each thing goes into the answer.
The guess is 30 minutes too short. This ride has no hills, so the hills knob does nothing here. Only the distance knob can fix it.
Read the desk from left to right. Each row takes one thing about the ride and multiplies it by its knob. That gives a share of the answer. Then the shares are added up.
Multiply each thing by its knob. Add up the results. That is the whole rule.
And ride 3 showed why this is worth doing. You set the knobs on two rides. They worked on a third ride you had not looked at. The knobs are not about those two rides. They are about riding: what a kilometre costs, and what a hill costs.
Let the machine set them
Two knobs were easy, because one ride was flat. Real rides are messier. There is wind, too. And we may not know in advance which things matter.
So let us be generous. We will give the machine four things to look at: the distance, the hills, the wind, and the number on the rider’s jersey. That last one is silly on purpose. A jersey number cannot change how long a ride takes. We want to see what the machine does with it.
The machine learns just as it did in chapter 3. It feels a slope for each knob, turns each knob a little downhill, and repeats.
The knobs are set badly. A typical guess is off by about 36 minutes. Orange bars are the rule’s guesses. Dark marks are the real times.
What the knobs tell you
When the machine has finished, its knobs are worth reading. Each knob tells you something about the world.
A big knob means the thing matters a lot. The hills knob ends near 6. Each hill adds about 6 minutes. That is more than two extra kilometres.
A minus sign means the thing pushes the other way. The tailwind knob ends below zero. More wind at your back means less time, not more.
A knob at zero means: ignore this. The jersey knob ends at zero. Whatever the jersey number is, zero times it is still zero. So it adds nothing to the answer.
The machine learned what to pay attention to, and what to ignore. Remember this. It is a small version of the idea this whole article is heading for.
Two kinds of number
The rule now has two kinds of number in it, and it is easy to mix them up. Try using the finished rule.
The rule says about 74 minutes: 65 for the distance, plus 12 for the hills, minus 3 for the wind at your back.
Notice which numbers you moved. In the last figure, the rides stayed the same and the knobs moved. Here the knobs stay the same, and the ride changes.
The things going in change with every question. The knobs are set once, by learning, and then stay put. Setting the knobs is called training. After that, you just use the machine.
The shape of every rule
Step back and look at the shape of what we have built:
It does not matter what the things are. Kilometres and hills. The size and age of a house. The brightness of each dot in a photo. Give each thing a knob, multiply, add, and let the machine set the knobs.
This shape is everywhere in machines that learn. The biggest ones are made of this one move, done millions of times. You will see it again in every chapter from here on.
What is still missing
This rule has a blind spot. It says every hill costs the same 6 minutes. The first hill, and the eighth. But by the eighth hill a real rider is tired, and slower.
A weighted sum cannot say that. Each knob gives one fixed price, however much of the thing there is. It is the straight line from chapter 1 again, just with more things going in. It can tilt, but it cannot bend.
The world is full of bends. The next chapter teaches the machine to make them.
- Build a rule that looks at several things at once.
- Read a knob: its size says how much a thing matters, and its sign says which way it pushes.
- Explain how a machine learns to ignore something useless.
- Tell the two kinds of number apart: the things going in, and the knobs.
- Spot the pattern inside every machine in this article: multiply each thing by its knob, then add.