A Bayesian network is a probabilistic model. It represents a set of variables as nodes in a graph, draws arrows from each variable to the variables it directly influences, and attaches a table of probabilities to each node. Given what you have observed, the network calculates the probabilities of what you have not.
The term is easier to understand in three parts: the graph, the tables, and the way the two combine.
The graph
Each node is a variable with uncertain values, such as rain (yes or no), sprinkler on (yes or no) and wet grass (yes or no). An arrow from one node to another means the first has a direct effect on the second. In this example, rain and the sprinkler both point to wet grass, since either one can make the grass wet.
The graph has no loops. Following the arrows never brings you back to where you started, which is why it is called a directed acyclic graph.
The tables
Every node has a conditional probability table. It lists the probability of each of the node’s values for every combination of values its parents can take. Rain has no parents, so its table is a plain probability. Wet grass has two parents, rain and sprinkler, so its table covers the four combinations of those two. The numbers below are illustrative:
| Rain | Sprinkler | P(wet grass) |
|---|---|---|
| yes | yes | 0.99 |
| yes | no | 0.90 |
| no | yes | 0.80 |
| no | no | 0.05 |
How the two combine
To get the probability of one complete scenario, multiply the entries that describe it. For example, multiply the chance of rain, the chance of no sprinkler, and the chance of wet grass given those two. The network never needs a single table covering every possible scenario. It keeps only the small tables, which is what makes networks practical when there are many variables.
Where the name comes from
The name refers to Thomas Bayes and to Bayes’ rule, which says how to update a probability when new evidence arrives. In this example, seeing wet grass raises the probability that it rained. A network does this kind of update for every variable at once, not just one.
A Bayesian network does not require Bayesian statistics to be built. Its tables can be estimated in several ways, and the name refers to reasoning with probabilities the way Bayes’ rule describes. Whether to fit a model with Bayesian statistics is a separate choice, covered in “Why is Bayesian statistics controversial?”
What you can do with one
Given some evidence, a network answers two kinds of question:
- Prediction asks how likely an effect is, given its causes. For example, how likely is wet grass, given that it rained?
- Diagnosis asks how likely each cause is, given an effect. For example, how likely is it that it rained, given that the grass is wet?
Both use the same tables, which is part of why the model is useful. Networks like these are one of the classic answers to “How to handle uncertainty in AI?”, because they state uncertainty as numbers and update those numbers as evidence comes in.
Where to go next
The worked numbers, the methods for answering questions in a large network, and how networks are learned from data are covered in Bayesian Networks Explained in Detail.
Limits to keep in mind
A network is only as good as its graph and tables. The tables must be estimated, from data or from experts, and they grow quickly when a node has many parents. A wrong assumption about which variables influence which can lead to misleading answers.