Probabilities and Predictions
Learning Objectives
- You understand and rehearse the concept of probability.
- You know that a computer can make predictions based on data.
Rock paper scissors
Rock paper scissors is a game where two players compete against each other. Both players pick one of the options (rock, paper, or scissors) at the same time, and show their choice to the other. The winner is determined based on the choices. Rock beats scissors, scissors beats paper, and paper beats rock. If both players pick the same option, the game is a draw.
You can play the game against the computer below. Your and the computer’s score is shown at the top of the game, followed by the options you can pick. Once you have made your choice, the choice that the computer made will be shown, and the winner will be determined. The game will continue until you decide to stop playing.
Rock paper scissors is an example of a finger-flashing game. The earliest known references to finger-flashing games are found in Egypt in the paintings at the Beni Hasan burial site, dating back to 2000 BC.
Probability
In the above rock paper scissors game, the computer selects the option randomly. If you play the game for a very long time, you will end up winning about one third of the games, losing about one third of the games, and drawing about one third of the games. This is because the computer picks the option randomly, and the probability of winning, losing, or drawing is equal for each option.
The term probability indicates the likelihood of an event happening. The probability of an event happening is a number between 0 and 1, where 0 indicates that the event will not happen, and 1 indicates that the event will happen. The greater the probability, the more likely it is that the event will happen.
In the next rock paper scissors game, the computer plays rock with a probability of 0.7, scissors with a probability of 0.2, and paper with a probability of 0.1. This means that the computer will play rock most of the time, scissors less often, and paper the least often.
With knowledge about the probabilities, you can make informed choices about what to play. This, in the long run, will lead you to winning more games. Try playing the following game for a while, and see if you can beat the computer.
Predictions and artificial intelligence
Knowledge about the probabilities of the computer’s choices allows you to make predictions about what the computer will play next. This is the essence of predictions: using the information you have to make guesses about what will happen next.
The term prediction refers to the process of making an educated guess about what will happen in the future. Predictions are based on the information available at the time of making the prediction, and the quality of the prediction depends on the quality of the information.
Making predictions is an essential part of human life. We make predictions about the weather, the stock market, sports events, and many other things. The ability to make predictions based on data is also a key feature of artificial intelligence.
The term artificial intelligence (AI) refers to the simulation of intelligence by machines (typically computers). AI is used to perform tasks that classically require human intelligence, such as weather forecasting, decision-making, and language translation.
The following version of the rock paper scissors game has an AI that tries to guess what you might choose next. Try playing the game for a while and see if you can beat the AI.
In the above game, the AI keeps track of your choices and searches for patterns. Based on the patterns it finds, the AI can make educated guesses about what you might choose next.
Although this might sound like magic, it is not. Seaching for patterns is similar to counting events or their combinations. Events or event combinations with high counts have occurred more often, while events or event combinations with low counts have occurred less often.
The following version of the game allows you to open up a table that displays the counts for all possible three choice combinations in the game. Try playing the game for a while and after that, see what sorts of choices did you make — were some combinations more frequent than others?
When you play, more and more data about your choices are being added to the table. This provides you insight about your choices and consequently also about the patterns that the AI can find.
Let’s next look into how the AI can make predictions by visiting concepts including probability distributions and probabilistic models.