Skip to content
BayesLab.Open the app →

BAYESLAB · LEARNING RESOURCES

What is a Bayesian network?

A Bayesian network represents uncertain variables and their conditional relationships using a directed acyclic graph and probability tables. It lets you update beliefs when you observe evidence.

By the BayesLab team · Updated 18 September 2026

Three pieces of a discrete network

  • Nodes represent variables with states, such as Rain = Yes or No.
  • Arrows specify which parent variables each variable’s probability distribution depends on. The graph cannot contain a directed cycle.
  • Conditional probability tables assign probabilities for each combination of parent states. Each distribution must sum to one.

The graph encodes assumptions about conditional independence. An arrow does not, on its own, establish a real-world causal effect. Causal conclusions require additional assumptions and evidence beyond a fitted probability model.

A worked example: rain and wet pavement

Imagine a simplified model with one arrow: Rain → Wet pavement. Suppose P(Rain) = 0.20, P(Wet | Rain) = 0.90, and P(Wet | No rain) = 0.10. These are teaching assumptions, not weather measurements.

Probability of wet or dry pavement in each rain state
Rain stateWetDry
Rain90%10%
No rain10%90%

Before observing anything, the total probability of wet pavement combines both possible rain states:

P(Wet) = 0.90 × 0.20 + 0.10 × 0.80 = 0.26

Now observe wet pavement. Bayes’ rule divides the probability of rain and wet pavement together by the total probability of wet pavement:

P(Rain | Wet) = (0.90 × 0.20) / 0.26 ≈ 0.6923

Your belief in rain rises from 20% to about 69.2%. It does not reach 100%, because the model allows the pavement to be wet without rain. The prior is your belief before this observation; the posterior is your updated belief after it.

Build and test the example in BayesLab

  1. Open the Bayesian network editor and add two chance nodes.
  2. Give Rain the states Yes and No, and Wet pavement the states Wet and Dry.
  3. Connect Rain to Wet pavement. Enter the prior and conditional probabilities above, checking the state labels carefully.
  4. Observe Wet pavement = Wet. Check that the probability of Rain = Yes is approximately 69.2%.
  5. Clear the evidence. Try Dry instead and explain the direction of the update before reading the result.

Common mistakes to discuss

P(Wet | Rain) is not the same as P(Rain | Wet). Reversing the condition ignores the base rate of rain and other reasons the pavement could be wet. Another mistake is treating an observed association as proof of causation.

Results are only as sound as your assumptions, input probabilities, and implementation. Use small examples with known answers while learning. BayesLab computes discrete network inference locally in the browser; it does not automatically discover a reliable model from your data.

Where to go next

Use the built-in examples and explanations in the app, or follow our classroom exercise. If you are evaluating software for a course, read the BayesLab and GeNIe comparison.