Why does AI use probability
Will it rain tomorrow? Will the coin you toss land heads? The world is full of things that are not certain. Still, we cannot just throw up our hands, so we put a number on how likely such things are. A 0 means it does not happen, and a 1 means it is sure to happen. Handling likelihood with numbers like this is probability.
Putting a number on likelihood
In the last lesson we summarized data already collected with the mean and the spread. But how do we handle something that has not happened yet? There is no data on tomorrow so far, so we put a number on its likelihood.
Something that can never happen gets 0, something certain gets 1, and a fifty-fifty chance sits in the middle at 0.5. Every probability lies somewhere between 0 and 1. When all outcomes are equally likely, as with a die, you divide the number of outcomes you want by the total number of outcomes.
Tap the events. Each likelihood is drawn as a bar from 0 to 1 and also shown as a percentage.
Seen as the length of a bar, a likelihood is easy to take in at a glance: the closer to 0, the shorter; the closer to 1, the longer. A percentage is just the 0-to-1 scale read times 100, so 0.5 is 50 percent and 0.25 is 25 percent.
A die shows 5 or more in two ways, 5 and 6, so the likelihood is two out of six, or one in three. But does a likelihood worked out like this really match what happens when you actually throw?
Rolling a die
A die has six faces, and since each face is equally likely, the probability of any one face is one in six. Yet rolling exactly six times does not give each face once. A 3 might happen to come up three times.
Here is the remarkable part. With few throws the results are uneven, but the more you throw, the closer the share of each face gets to one in six. This is called the law of large numbers.
Tap roll. The next face comes up in a fixed order set in advance, and the more you throw, the closer each face's share gets to 1 in 6.
At first the bars were bumpy: some faces came up a lot and others only a little. But as the rolling went on, the six bars evened out to similar heights.
That is why you should not jump to conclusions from one or two results; the true picture only shows once you gather many. It is also why machine learning tries to collect so many examples. So how do you work out the chance of two things happening together?
Two things happening together
What is the chance that a coin lands heads and, at the same time, a die shows 6? The coin and the die have no effect on each other. Events unrelated like this are called independent, and the chance of two independent events happening together is found by multiplying their chances.
Heads is one in two and a 6 is one in six, so multiplying them gives one in twelve. But if one event affects the other, you cannot simply multiply. For example, the chance that the same die is both even and a 6 is still one in six, because a 6 is already even.
Pick two events to combine. As their chances are multiplied, the chance of both happening together becomes smaller than either one.
Multiplying the two chances gave a result smaller than either of them. That makes sense: the more conditions that must all hold, the rarer the outcome. It is like how hard it is for several strokes of luck to arrive at once.
Now let's see what probability is used for. Even when the world is uncertain, we can compare likelihoods and choose the most likely option.
Choosing the most likely option
Often you have to decide even when you cannot know for sure. In that case, you give each candidate a likelihood and pick the biggest. If the animal in a blurry photo is a cat with probability 0.7 and a dog with probability 0.2, you answer cat.
You might be wrong, but it is the most plausible answer. Remember too that the probabilities of all the candidates add up to one, since one of them has to be the answer. This is exactly how AI chooses answers.
Tap the blurry photos one at a time. Each candidate gets a probability and the most plausible answer is chosen. When the probabilities are close, it also shows that the answer is uncertain.
AI does not claim to know the right answer for certain. It gives probabilities to several candidates and offers the biggest one as its answer. So when the probabilities are close it is less sure, and when one stands out it answers confidently.
The large language models covered later stand on this same idea. When continuing a sentence, they give a probability to each candidate for the next word and then pick one of them.
Summary
To sum up: probability puts a number between 0 and 1 on likelihood. When you try something many times, as with a die, the share gets close to the true probability. The chance of two events that do not affect each other happening together is found by multiplying their chances.
And when things are uncertain, you choose the most plausible option. AI chooses its answers with probability in just the same way.
Tap the key points in order to review. (likelihood as 0 to 1 → many tries make the share settle → together means multiply → choose the most plausible option)
Now you can handle uncertain things with numbers. Bewildering chance has become something you can grasp, as a number between 0 and 1.
With statistics and probability in hand, it is time to actually pull a rule out of data. The next lesson, on linear regression, covers how to find the straight line that passes best through scattered points and use it to predict the next value.