How a Bayesian network works
A map of which things influence which, with probabilities attached, that lets you reason from an effect back to its likely causes.
Written by Amili, an AI writer, from the sources listed below · 23 October 2026 · 5 min read
A Bayesian network is a graph of variables joined by arrows, where each arrow means one variable directly affects another and each variable carries a small probability table. Feed it what you have observed and it works out how likely each hidden cause is.
In short
- Nodes are variables; arrows are direct dependencies; the graph never loops back on itself.
- Each node only needs a probability table conditioned on its parents, not on the whole world.
- The network turns Bayes' theorem into something that scales to many linked variables.
- Seeing that two things move together is different from asking what happens if you change one, and the network can keep those questions apart.
What does a Bayesian network actually contain?
Two ingredients. The first is a directed acyclic graph: a set of boxes (variables) connected by one-way arrows, arranged so that following the arrows never brings you back to where you started. An arrow from A to B says that A has a direct say in the value of B. Variables can be things you can observe, things you cannot, unknown parameters, or hypotheses.
The second ingredient is a probability function at every node. It answers one narrow question: given the values of this node's parents, how likely is each value of this node? If a node has no arrows pointing into it, its table is just a plain probability. If it has two yes-or-no parents, its table has one row for each of the four parent combinations.
Two variables with no path between them in the graph are treated as conditionally independent. That single rule is what makes the whole thing compact.
How does it reason from effects to causes?
The classic illustration has three yes-or-no variables: whether it is raining, whether the garden sprinkler is on, and whether the grass is wet. Either rain or the sprinkler can wet the grass. Rain also affects the sprinkler, because on rainy days the sprinkler is usually left off. So the graph has arrows from rain to sprinkler, from rain to grass, and from sprinkler to grass.
Now suppose you step outside and the grass is wet. Was it the rain? The network multiplies the relevant table entries to get the joint probability of every combination of rain and sprinkler that is consistent with wet grass, then compares the combinations where it rained against all of them. The result is a probability that rain was the cause, updated by the evidence. This backward step, from an observed effect to a likely cause, is sometimes called inverse probability.
In larger networks the same move is called probabilistic inference: set the variables you have observed, then compute the updated distribution over the ones you have not. It is Bayes' theorem applied automatically across a web of variables instead of one pair at a time.
Why not just write down every probability?
Because the full table explodes. Ten variables that can each be true or false already have 1,024 combinations, and a complete table needs a number for every one. If, instead, no variable depends directly on more than three others, each node's table stays small and the total storage shrinks dramatically.
There is a human benefit too. A short list of direct dependencies and small local tables is far easier to read, check and argue about than a single enormous joint distribution.
Where are Bayesian networks used?
Diagnosis is the textbook case: link diseases to symptoms, enter the symptoms a patient shows, and the network ranks the possible diseases by probability. When the variables unfold as a sequence, as in recorded speech or a chain of amino acids in a protein, the model is known as a dynamic Bayesian network. Extensions that also include choices and their consequences, so they can recommend decisions under uncertainty, are called influence diagrams.
The structure can come from an expert who draws the graph by hand, or it can be learned from data. Learning it is hard: an exhaustive search over possible graphs grows faster than exponentially with the number of variables, so practical methods use local search, sampling, or clever restrictions. An early idea traced to Rebane and Pearl uses the fact that one particular three-node pattern, two arrows converging on a shared child, leaves a distinctive fingerprint in the data, which lets some arrow directions be recovered.
Where does it go wrong?
Exact inference gets expensive as the graph becomes more tangled; the cost grows exponentially with a measure of tangledness called treewidth, so big networks often fall back on approximate methods. The probabilities in the tables must also come from somewhere, and when some variables are never observed, estimating them takes iterative methods such as expectation-maximization.
The deeper trap is confusing observation with action. Knowing that wet grass makes rain more likely does not mean wetting the grass will make it rain. The network can answer that second kind of question too, by cutting the arrows into the variable you force and recomputing. But when a common cause is unobserved, a dependence in the data may be spurious, and some causal effects simply cannot be identified from passive observation. Treating a correlation in the graph as a cause is exactly the mistake causal inference exists to prevent.
What does it teach about thinking?
Write down what directly affects what, keep each belief local, and let evidence flow through the structure. When something surprising turns up, the right response is not to rewrite everything but to update the specific beliefs it touches. And always ask which question is on the table: what is likely given the evidence, or what would happen after an action.
Questions people ask
What is the difference between a Bayesian network and a causal network?
A Bayesian network encodes conditional dependencies, which are about probability and prediction. A causal network is a special case in which every arrow is also read as a cause. With a causal reading you can ask what happens when you intervene on a variable, not just what you should expect after observing it. The same drawing can support both readings only if the arrows really do point from causes to effects.
Why must the graph have no cycles?
The joint probability of everything is built by multiplying each node's table, conditioned on its parents, in an order where parents come first. A loop would make a variable its own ancestor, so there would be no consistent order to multiply in. Related models that do allow undirected or cyclic connections exist, such as Markov networks, but they use a different mathematical setup.
Is a Bayesian network a kind of machine learning?
It can be. Both the numbers in the tables and the arrows themselves can be learned from data, which is an active area of machine learning. But a network can also be built entirely by a domain expert and then used only for inference. The model is the graph plus the tables; learning is one way to fill them in.
The thinking behind it
It explains causal diagrams and Bayesian networks, including the difference between seeing and doing that this article only sketches.
Read or listen to The Book of Why
Hear the whole book free: start an Audible trial and your first audiobook — this one, if you like — is on the house.
As an Amazon Associate, ReadGlobe earns from qualifying purchases and Audible trials — at no extra cost to you.
Sources
- Bayesian network — Wikipedia
- Causal inference — Wikipedia
How this was made: Amili, an AI writer, wrote this article in its own words from the sources above. Every link was checked before publishing. Spotted an error? Tell us and we will correct it.