Probabilistic Reasoning and Bayesian Networks

Learn how an intelligent agent reasons when it cannot be sure. Start with probability, conditional probability and Bayes' rule, and see how independence keeps models small. Represent dependencies in Bayesian networks, read independences from the graph with d-separation, and compute exact answers with variable elimination or approximate ones with sampling. Finish by choosing actions that maximize expected utility and by working out what an observation is worth before you make it.

IntermediateLesson 6 of 10 in Artificial Intelligence Course

What you will learn

  1. Describe an uncertain situation with random variables and distributions, answer questions from a full joint distribution, update beliefs with Bayes' rule and use independence to keep models small.
    • Describe uncertainty with random variables and joint distributions
      Use sample spaces, events, random variables and joint distributions to state what an agent believes, and find single-variable probabilities by summing out the others.
    • Answer queries with conditional probability and enumeration
      Compute conditional probabilities, use the product and chain rules, and answer any query from a full joint distribution by selecting, summing out and normalizing.
    • Update beliefs with Bayes' rule
      Derive Bayes' rule, turn causal knowledge into diagnostic conclusions, and avoid ignoring base rates.
    • Use independence, conditional independence and naive Bayes
      Test whether variables are independent or conditionally independent, explain how independence shrinks a model, and classify with a naive Bayes model.
  2. Read and build Bayesian networks, compute joint probabilities from their tables, and decide from the graph which independences hold.
    • Read a Bayesian network and compute joint probabilities
      Explain the parts of a Bayesian network, compute any full joint probability as a product of table entries, and count how many numbers a network needs.
    • Build compact networks and read their local independences
      Construct a network by choosing an ordering and minimal parents, use the local Markov property and Markov blankets, and model many parents with compact CPTs.
    • Decide independence with d-separation
      Classify the three kinds of triples, test every path between two variables, and conclude which conditional independences the graph guarantees.
  3. Answer probability queries in a Bayesian network exactly, first by enumeration and then efficiently by variable elimination, and judge how the cost grows.
    • Answer queries in a network by enumeration
      Write a query as a normalized sum of products of CPT entries, evaluate it, and remove variables that cannot affect the answer.
    • Run variable elimination and choose good elimination orders
      Represent CPTs as factors, join and sum them out one hidden variable at a time, normalize, and explain how the elimination order and network shape determine the cost.
  4. Estimate probabilities in a Bayesian network by generating samples, and compare prior sampling, rejection sampling, likelihood weighting and Gibbs sampling.
    • Estimate probabilities with prior sampling and rejection sampling
      Draw samples from a network in topological order, estimate probabilities from counts, and use rejection sampling for conditional queries.
    • Estimate conditional probabilities with likelihood weighting
      Fix the evidence, sample the other variables, weight each sample by how well it explains the evidence, and recognize when the method struggles.
    • Estimate posteriors with Gibbs sampling
      Resample one variable at a time from its distribution given its Markov blanket, use the resulting chain of states as samples, and compare the sampling methods.
  5. Choose actions that maximize expected utility, model decisions with decision networks, and calculate what an observation is worth before making it.
    • Choose actions by maximum expected utility
      Express preferences as utilities, compute expected utilities of uncertain outcomes, and explain risk attitudes and the axioms behind the principle.
    • Model and solve decisions with decision networks
      Extend a Bayesian network with decision and utility nodes, evaluate every action with the evidence available, and find the best policy.
    • Calculate the value of perfect information
      Compute how much an observation is expected to raise the maximum expected utility, use its properties, and decide whether information is worth its cost.

Bayesian Networks study guide

5 chapters

1

Reason with probability, Bayes' rule and independence

An agent needs a precise way to describe what it knows when observations are incomplete. Begin with possible worlds and joint tables, then condition on evidence and reverse conditional probabilities with Bayes' rule. Independence identifies which observations add information and which become redundant once a relevant condition is known. These operations provide the arithmetic used throughout probabilistic inference.

1.1 Describe the possible worlds

An agent may see only part of its environment. A sensor can be noisy, and an action can have several outcomes. Probability lets the agent attach a degree of belief to each possibility and revise those beliefs when information arrives.

Worlds, events and variables

The sample space, Ω, lists every possible outcome. Its outcomes are mutually exclusive and exhaustive: exactly one occurs. An event is a set of these outcomes, such as "the bus is late." Its probability is the sum of the probabilities of its outcomes.

A random variable assigns a value to each outcome. Its domain lists the possible values. For example, Weather has the domain {sun,cloud,rain}. Write variables with capital letters and values in lowercase. For Boolean Rain, r means true and ¬r means false. The comma in P(r,t) means "and."

Probabilities lie between 0 and 1, and the probabilities of all outcomes sum to 1. Complementary events satisfy P(¬a)=1−P(a). A distribution lists the probability of each value of a variable; a prior describes belief before incorporating the evidence of interest.

Read a joint table

A joint distribution gives the probability of each combination of values. Here is a weather and bus model:

WeatherOn timeLate
Sun0.400.10
Cloud0.180.12
Rain0.080.12

The six cells are the six possible worlds, and together they sum to 1. A row total is the probability of that weather, so a row need not sum to 1. For rain, P(rain)=0.08+0.12=0.20. The late column gives P(late)=0.10+0.12+0.12=0.34.

This operation is marginalization, or summing out. To keep X and remove Y, use P(x)=∑yP(x,y). Add across every value of the variable being removed, including false values for Boolean variables.

Count an overlap once

The event "rain or late" includes every cell in the rain row or late column. Its probability is

P(rain∨late)=0.20+0.34−0.12=0.42.

The subtraction removes the overlap counted twice. In general, P(a∨b)=P(a)+P(b)−P(a,b). Simply adding the marginals would give 0.54 and count the rainy, late world twice.

Why full tables become expensive

A full joint table can answer any probability query about its variables, but its size grows quickly. Each additional Boolean variable doubles the number of worlds. With n Boolean variables there are 2n entries and 2n−1 free numbers, since the last entry is fixed by the total of 1. Thirty Boolean variables require 1,073,741,824 entries. Compact models will store local dependencies instead of listing every world explicitly.

Key Takeaways

  • A joint table assigns probabilities to complete combinations of values.
  • Marginalization adds over all values of a variable you want to remove.
  • For an "or" event, subtract the overlap once.
  • The whole joint table sums to 1; individual rows generally do not.

1.2 Condition on evidence and normalize

A late bus changes which weather conditions seem likely. Conditional probability focuses on the worlds consistent with an observation, then measures their relative shares. The probability after taking evidence into account is a posterior.

Keep the denominator tied to the evidence

For evidence with positive probability,

P(a∣b)=P(a,b)P(b).

In the weather and bus model, the late entries for sun, cloud and rain are 0.10, 0.12 and 0.12. Their total is 0.34. Thus P(rain∣late)=0.12/0.34≈0.353. Reversing the question gives P(late∣rain)=0.12/0.20=0.6. Both use the same joint cell, but each divides by the probability of its own evidence.

The whole conditional distribution is P(Weather∣late)≈⟨0.294,0.353,0.353⟩. These entries sum to 1 because they describe alternative weather values under one fixed observation. The three likelihoods P(late∣sun)=0.2, P(late∣cloud)=0.4 and P(late∣rain)=0.6 use different conditions and need not sum to 1.

Products and chains

Rearranging the definition gives the product rule:

P(a,b)=P(a∣b)P(b)=P(b∣a)P(a).

Applying it repeatedly gives the chain rule:

P(x1,…,xn)=∏i=1nP(xi∣x1,…,xi−1).

Any variable order works. Independence is not needed for this identity; it will later let us shorten the condition lists.

Select, sum and normalize

For query variable X, evidence e and hidden variables Y, enumeration uses

P(X∣e)=α∑yP(X,e,y).

First select worlds matching the evidence. Next sum out all hidden variables, keeping a separate total for each query value. Finally divide these totals by their sum. The normalizing constant α is the reciprocal of that sum, which is P(e).

Consider Boolean variables Flu (F), Fever (V) and Cough (K). Their full joint table is:

FluFeverCoughProbability
TrueTrueTrue0.056
TrueTrueFalse0.024
TrueFalseTrue0.014
TrueFalseFalse0.006
FalseTrueTrue0.018
FalseTrueFalse0.072
FalseFalseTrue0.162
FalseFalseFalse0.648

To find P(F∣v), retain fever rows and sum out cough. The totals are 0.056+0.024=0.08 for flu and 0.018+0.072=0.09 for no flu. Normalize by 0.17 to get P(f∣v)≈0.471.

If cough is also observed, retain only the two fever-and-cough rows. Now P(f∣v,k)=0.056/0.074≈0.757. For fever without cough, P(f∣v,¬k)=0.024/0.096=0.25. Summing over cough would lose this additional observation. A raw total such as 0.08 is a joint probability, not the requested conditional probability.

Key Takeaways

  • Conditional probability divides a joint probability by the probability of the evidence.
  • The chain rule holds for any variable order.
  • Enumeration selects evidence, sums hidden variables and normalizes.
  • A conditional distribution sums to 1 over the query values.
  • Keep observed values fixed when summing.

1.3 Use Bayes' rule without losing the base rate

An agent often knows how a cause produces an observation, but needs to reason in the other direction. A fault model may describe how often a damaged component triggers a warning. After the warning, the agent needs the probability of damage.

Reverse a conditional correctly

The two product-rule expressions for a joint probability give Bayes' rule:

P(c∣e)=P(e∣c)P(c)P(e).

Here P(c) is the prior, P(e∣c) is the likelihood, and P(c∣e) is the posterior. The denominator includes every way the evidence can occur. For a Boolean cause, the law of total probability gives

P(e)=P(e∣c)P(c)+P(e∣¬c)P(¬c).

For more than two cause values, include one term for each value. You can also compute a likelihood-times-prior score for each cause and normalize the scores.

Work through a rare-condition example

Suppose an illness affects 1% of a population. A test is positive for 90% of ill people and 5% of healthy people. The probability of a positive result is

P(+)=0.9(0.01)+0.05(0.99)=0.009+0.0495=0.0585.

The ill-and-positive probability is 0.009, so

P(ill∣+)=0.009/0.0585≈0.154.

Natural frequencies make the denominator easier to see. Among 10,000 people, 100 are ill and 90 of those test positive. Of 9,900 healthy people, 495 test positive. There are 585 positive results altogether; 90 belong to ill people.

The 90% sensitivity answers "How often does an ill person test positive?" It does not answer "How often is a positive person ill?" Base-rate neglect gives the prior too little weight. A rare condition starts with far fewer people, so false positives from the larger healthy group can outnumber true positives. If sensitivity and false-positive rate stay fixed, changing the prevalence still changes the posterior.

A negative result uses the complementary likelihoods:

P(ill∣−)=0.1(0.01)0.1(0.01)+0.95(0.99)≈0.0011.
Update again when new evidence arrives

The posterior from one observation becomes the prior for the next. If a second test result is conditionally independent of the first given illness status, another positive produces

P(ill∣+,+)=0.92(0.01)0.92(0.01)+0.052(0.99)≈0.766.

Carry the unrounded first posterior when doing sequential arithmetic. Conditional independence matters: repeated readings from the same faulty sensor may share an error, so multiplying their likelihoods as independent evidence can overstate the update.

Background information stays in every relevant condition:

P(c∣e,b)=P(e∣c,b)P(c∣b)P(e∣b).

This lets an agent update within the population or situation it already knows about, using its current prior and the appropriate likelihoods.

Key Takeaways

  • Bayes' rule multiplies the likelihood by the prior and divides by the evidence probability.
  • The evidence probability includes all possible causes.
  • A high sensitivity can coexist with a low posterior when the condition is rare.
  • Sequential updates use the current posterior as the next prior.

1.4 Use independence to shrink a model

Some observations change one another's probabilities; others add no information once a relevant condition is known. Independence identifies when a long probability expression can be replaced by smaller pieces.

Independence is a statement about every value

Events are independent when P(a,b)=P(a)P(b). For variables, this equality must hold for every pair of values. One failed pair establishes dependence. In the weather table, P(rain,late)=0.12, whereas P(rain)P(late)=0.20(0.34)=0.068, so weather and bus status are dependent.

Mutually exclusive events with positive probabilities are dependent: learning that one occurred forces the other's probability to zero. Independent events can occur together. If n Boolean variables are all mutually independent, only n probabilities are needed, compared with 2n−1 for an unrestricted joint table.

Know what is being held fixed

Conditional independence, written X⊥Y∣Z, means

P(x,y∣z)=P(x∣z)P(y∣z).

The equality holds for every relevant value combination. Equivalently, learning Y adds nothing about X once Z is known.

In the flu model, P(k∣v,f)=P(k∣f)=0.7 and P(k∣v,¬f)=P(k∣¬f)=0.2. Fever and cough are conditionally independent given flu status. Without that condition, they are dependent: P(k)=0.25, while P(k∣v)=0.074/0.17≈0.435. Fever changes belief about flu, which changes belief about cough.

ClaimWhat must be checked
IndependenceJoint equals product of marginals for every value pair
Conditional independenceConditional joint equals product within each value of the condition

Independence without evidence and independence given evidence are separate claims. Observing a common effect can even make two previously independent causes dependent.

Classify with naive Bayes

A naive Bayes model assumes that features are conditionally independent given a class. Its posterior is

P(C∣e1,…,en)=αP(C)∏iP(ei∣C).

A Boolean class with n Boolean features needs 1+2n probabilities. The assumption can be imperfect and still support useful classification, but correlated features can lead to overconfident probabilities.

For spam, let P(spam)=0.3. The word "offer" appears with probability 0.4 in spam and 0.05 in nonspam, called ham. The word "winner" appears with probabilities 0.2 and 0.01. With both words present, the scores are 0.3(0.4)(0.2)=0.024 for spam and 0.7(0.05)(0.01)=0.00035 for ham. Normalizing gives P(spam∣o,w)≈0.986.

Absence also supplies evidence. With "offer" present but "winner" absent, the scores become 0.3(0.4)(0.8)=0.096 and 0.7(0.05)(0.99)=0.03465, giving a spam posterior of about 0.735. Use the complement of the likelihood for an absent Boolean feature. A zero likelihood makes the entire class score zero, so a possible event should not receive a zero merely because it was missing from a small data sample.

Key Takeaways

  • One failed joint-product equality establishes dependence.
  • Conditional independence concerns distributions within a fixed condition.
  • Mutual exclusivity with positive probabilities creates dependence.
  • Naive Bayes multiplies feature likelihoods conditional on the class.
  • Absent Boolean features use complementary likelihoods.
  • Normalize class scores when a probability is required.
2

Represent dependencies with Bayesian networks

A Bayesian network replaces an enormous joint table with a graph and small local tables. Reading its arrows tells you which probabilities to store and how to multiply them into a complete-world probability. Building the graph requires careful independence choices, and d-separation tests those choices across paths. Local properties and structured tables make larger models easier to represent.

2.1 Read a network and multiply its tables

A Bayesian network represents a joint distribution with a directed acyclic graph and local probability tables. Each node is a random variable. An arrow into a node identifies one of its parents; following arrows must never lead back to the starting node.

A commute model

Use five Boolean variables: Rain (R), Accident (A), heavy Traffic (T), being Late (L) and carrying an Umbrella (U). The arrows are R→T, A→T, T→L and R→U. Rain and accident have prior probabilities P(r)=0.2 and P(a)=0.1.

Traffic's conditional probability table (CPT) depends on both parents:

RainAccidentProbability of heavy traffic
TrueTrue0.95
TrueFalse0.70
FalseTrue0.80
FalseFalse0.20

The remaining tables give P(l∣t)=0.6, P(l∣¬t)=0.1, P(u∣r)=0.9 and P(u∣¬r)=0.2. Each parent assignment selects a distribution over the child's values. For Boolean nodes, store only the true probability; the false probability is its complement. Thus P(¬t∣r,¬a)=0.3.

Compute a complete world's probability

The network defines its joint distribution by

P(x1,…,xn)=∏iP(xi∣parents(Xi)).

For rain, no accident, heavy traffic, lateness and an umbrella, select one entry from every node:

P(r,¬a,t,l,u)=0.2(0.9)(0.7)(0.6)(0.9)=0.06804.

The factors respectively describe rain, no accident, traffic under those parent values, lateness under heavy traffic and umbrella use under rain. Omitting a node gives an incomplete product. Selecting 0.95 for traffic would describe an accident too, so it would mismatch the world being evaluated.

The formula follows from the chain rule in a topological order, with parents before children. The network's conditional independences shorten each condition from all preceding variables to just its parents.

Count parameters and distinguish marginals

A Boolean node with k Boolean parents needs 2k free probabilities. More generally, a node with d values and k parents each with d values needs (d−1)dk. The commute network needs 1+1+4+2+2=10 numbers; a full joint over its five Boolean variables needs 31. Thirty Boolean nodes with at most five parents each need at most 960 numbers, compared with more than a billion for an unrestricted full joint.

A CPT entry answers a question with every parent fixed. To find a marginal, average over the missing parent values. Here

P(t)=0.019+0.126+0.064+0.144=0.353,

where the four terms weight the traffic rows by their parent probabilities. Similarly, P(t∣r)=0.1(0.95)+0.9(0.7)=0.725. It is not the single row value 0.7.

Arrows often follow cause to effect because that makes the model compact and understandable. Formally they encode a factorization and independence claims. A reversed two-node graph can represent the same joint distribution with different tables; an arrow alone does not establish causation.

Key Takeaways

  • Each node has a probability table conditioned on its parents.
  • Multiply one matching entry per node for a complete assignment.
  • Each CPT row sums to 1 over the child values.
  • Average over unknown parents to obtain a marginal.
  • A graph encodes conditional independences; causal interpretation needs more.

2.2 Choose parents and find a Markov blanket

A useful network leaves out dependencies that are unnecessary while keeping those the distribution needs. Choosing few parents can save many table entries, but each omission commits the model to an independence claim.

Build the network in an order

Choose variables and their domains, then order the variables. For each variable, select a minimal set of earlier variables that makes it independent of the other earlier variables. Add arrows from these parents and fill its CPT using expert judgment or probabilities estimated from counts.

A cause-first order for the commute model produces four arrows and ten free probabilities. Another valid order is L,T,U,R,A, with parent sets T:{L}, U:{T}, R:{T,U} and A:{T,R}. This uses six arrows and 1+2+2+4+4=13 numbers. Given traffic, rain changes belief about an accident, so rain must remain among accident's parents in that order.

Any order can represent the distribution if each node receives enough parents. Giving every node all earlier nodes always works but offers no compression. A diagnostic order can also require probabilities that are harder to judge, such as rain given traffic and an umbrella. Omitting a needed parent forces a false independence; adding an unnecessary parent enlarges the table.

Two local independence rules

The local Markov property says a node is independent of its non-descendants given its parents. In the commute network, L⊥{R,A,U}∣T and U⊥{A,T,L}∣R. Once traffic is known, the other variables add nothing about lateness.

A node's Markov blanket contains its parents, its children and its children's other parents. Given these variables, the node is independent of every variable outside the blanket. Rain's blanket is {T,U,A}: accident belongs because it is traffic's other parent. Traffic's blanket is {R,A,L}, and lateness has only {T}. The blanket allows local updates even when the full network is large.

Replace a large table with structure

A deterministic node is a fixed function of its parents, such as Late=Traffic∨Strike. Its rows contain zeros and ones. A noisy-OR allows each true cause to fail independently. If cause i has inhibition probability qi, the effect is absent only if all active causes fail:

P(¬effect∣active causes)=∏i activeqi.

Suppose an accident fails to cause a jam with probability 0.2 and roadworks fail with probability 0.4. An accident alone gives a jam probability of 0.8; roadworks alone gives 0.6. When both occur, the no-jam probability is 0.2(0.4)=0.08, so the jam probability is 0.92.

Plain noisy-OR gives no effect when no cause is active. A leak, represented as an always-present cause, allows the effect to arise from unlisted causes. The model uses one inhibition probability per cause instead of an unrestricted table with 2k rows. This saving comes from independent causal failures; arbitrary interactions require a richer model.

Key Takeaways

  • Choose parents that make a node independent of other earlier variables.
  • A variable order changes the size and interpretation of its tables.
  • A Markov blanket includes children's other parents.
  • Noisy-OR multiplies independent failure probabilities of active causes.
  • A leak accounts for unlisted causes.

2.3 Trace paths to decide independence

d-separation finds conditional independences guaranteed by a network's graph. It considers paths without requiring arrows to point along the direction of travel. Arrowheads still matter because they determine how each middle node behaves.

Three path patterns
PatternMiddle node unobservedMiddle node observed
Chain: X→Y→ZActiveBlocked
Fork: X←Y→ZActiveBlocked
Collider: X→Y←ZBlocked unless a descendant is observedActive

In a chain, knowing the middle variable screens off the earlier variable. In R→T→L, rain adds nothing about lateness once traffic is known. In a fork, knowing the shared cause does the same: an umbrella adds nothing about traffic once rain is known.

A collider, or common effect, works in the opposite way. The path R→T←A is blocked without evidence at traffic or its descendants. Observing traffic, or observing lateness downstream, opens the collider. Causes that were independent can then inform one another.

Explaining away

In the commute model, P(a∣r)=P(a)=0.1. Heavy traffic increases the accident probability to about 0.235. Adding rain reduces it to P(a∣t,r)≈0.131; adding no rain gives P(a∣t,¬r)≈0.308. Rain accounts for some of the observed traffic, reducing the need for an accident as an explanation. This is explaining away.

Check every path

To test X⊥Y∣Z:

  1. List every undirected path between the query variables.
  2. At each internal node, identify whether the path forms a collider or a non-collider.
  3. Block a path if it has an observed non-collider, or a collider with neither itself nor any descendant observed.
  4. Conclude d-separation only if every path is blocked.

For umbrella and accident, the only path is U←R→T←A. With no evidence, traffic blocks it, so U⊥A. Given lateness, traffic's collider opens and rain remains unobserved, so the path becomes active. The numerical model gives P(u∣l)≈0.434 but P(u∣a,l)≈0.356.

If both lateness and rain are observed, traffic's collider is still open, but rain blocks the path as an observed non-collider. Therefore U⊥A∣L,R. Opening one part of a path does not overcome a block elsewhere.

Umbrella and lateness have path U←R→T→L. It is active without evidence and blocked by either rain or traffic. For example, P(l∣u,r)=P(l∣r)=0.4625.

Interpret the graph's guarantee

d-separation is sound: the independence holds for every distribution that follows the graph. An active path means independence is not guaranteed. Particular CPT values may still make the variables independent by coincidence. In a graph with several paths, inspecting one blocked path is insufficient; another path may remain active.

Key Takeaways

  • Chains and forks are blocked by observing their middle node.
  • A collider opens when it or one of its descendants is observed.
  • Every path must be blocked for d-separation.
  • Explaining away links causes after observing a shared effect.
  • An active path removes the guarantee of independence.
  • One blocked internal node blocks its entire path.
3

Compute exact answers with enumeration and variable elimination

Exact inference combines the local probability tables to answer a conditional query. Enumeration makes the full sum of products explicit, while variable elimination reuses shared partial results. Both methods return the same posterior, but their computational costs can differ sharply. Evidence restriction, removal of irrelevant variables and a careful elimination order keep the work focused on the query.

3.1 Enumerate worlds in a network

A network stores a joint distribution as local pieces. Exact inference combines those pieces to answer a query, adding over variables whose values remain unknown. Enumeration is the direct way to do this.

Separate the three variable roles

In P(X∣e), X is the query variable and e fixes the evidence. Every other variable is hidden. Substitute the network product into the general enumeration formula:

P(X∣e)=α∑y∏iP(xi∣parents(Xi)).

Compute an unnormalized total for every value of the query, then divide by their sum. Evidence values stay fixed in every product. Hidden variables range over their entire domains.

For the commute model, with arrows R→T←A, T→L and R→U, the query P(R∣l) hides accident, traffic and umbrella. Each complete term uses P(R)P(A)P(T∣R,A)P(l∣T)P(U∣R).

Remove an irrelevant leaf

Umbrella has no observed descendant and is neither the query nor evidence. Summing its CPT over both values gives ∑u′P(u′∣r)=1 for each rain value. Its contribution disappears.

More generally, retain query variables, evidence variables and all their ancestors. Other variables can be removed by summing irrelevant leaves first, then working backward. This is a statement about their contribution to this query; an unobserved node can matter in a different query.

Evaluate the two rain totals

The commute tables give P(r)=0.2, P(a)=0.1, traffic probabilities 0.95, 0.7, 0.8 and 0.2 for parent combinations (r,a),(r,¬a),(¬r,a),(¬r,¬a), and lateness probabilities 0.6 with traffic and 0.1 without it.

For rain and an accident, sum the traffic alternatives: 0.95(0.6)+0.05(0.1)=0.575. For rain without an accident, the result is 0.7(0.6)+0.3(0.1)=0.45. Weight by accident probabilities, then by rain:

P(r,l)=0.2[0.1(0.575)+0.9(0.45)]=0.0925.

For no rain, the corresponding inner totals are 0.5 and 0.2, giving

P(¬r,l)=0.8[0.1(0.5)+0.9(0.2)]=0.184.

Normalize by 0.0925+0.184=0.2765. The answer is P(R∣l)≈⟨0.335,0.665⟩ for true and false. Reporting 0.0925 would report the joint event, before conditioning.

Keep sums attached to their dependencies

A factor moves outside a sum only if none of its arguments depends on the summed variable. For example, P(r) can move outside the accident sum; P(t∣r,a′) cannot because accident is a parent argument.

If umbrella is observed, it no longer sums away. With P(u∣r)=0.9 and P(u∣¬r)=0.2, the new posterior is 0.08325/(0.08325+0.0368)≈0.693. Enumeration can run depth-first with little memory, but visits exponentially many hidden assignments and repeats partial calculations.

Key Takeaways

  • Fix evidence and sum over every hidden assignment.
  • Remove variables outside the ancestors of query and evidence.
  • A factor can leave a sum only if it does not depend on the summed variable.
  • Normalize joint totals to obtain the posterior.

3.2 Reuse partial sums with variable elimination

Enumeration repeats work because many complete worlds share the same partial calculation. Variable elimination (VE) stores these partial results as factors and reuses them. It computes the same exact posterior in a different arithmetic order.

Factors, joins and evidence

A factor maps assignments of its variables to nonnegative numbers. CPTs are starting factors, but intermediate factors need not sum to 1. Apply evidence by retaining the observed value. For lateness evidence, P(l∣T) is a factor over traffic with entries 0.6 and 0.1.

Joining factors multiplies matching entries and uses the union of their variable sets. Joining P(A) and P(T∣R,A) gives a factor over rain, accident and traffic. Summing out accident adds entries that differ only in accident's value.

For each hidden variable, join every factor containing it, sum it out, and replace those factors with the result. Keep factors that do not mention it. At the end, join the remaining factors and normalize over the query values.

Eliminate accident, then traffic

For P(R∣l), remove the unobserved umbrella leaf. Start with P(R), P(A), P(T∣R,A) and P(l∣T). Eliminating accident gives

f1(R,T)=∑a′P(a′)P(T∣R,a′).

Its true-traffic values are f1(r,t)=0.1(0.95)+0.9(0.7)=0.725 and f1(¬r,t)=0.1(0.8)+0.9(0.2)=0.26. The false-traffic values are 0.275 and 0.74.

Now eliminate traffic:

f2(R)=∑t′f1(R,t′)P(l∣t′).

This gives f2(r)=0.725(0.6)+0.275(0.1)=0.4625 and f2(¬r)=0.26(0.6)+0.74(0.1)=0.23. Multiplying by the rain prior gives ⟨0.0925,0.184⟩. Divide by 0.2765 to get ⟨0.335,0.665⟩.

Eliminating traffic first also works. The factor g(R,A)=∑t′P(t′∣R,A)P(l∣t′) has entries 0.575, 0.45, 0.5 and 0.2. Weighting by the accident prior then produces the same two lateness likelihoods.

Choose an order that keeps factors small

A factor over k variables with d values has dk entries. The largest intermediate scope usually dominates the cost. Suppose hidden Z points to Boolean variables X1,…,Xn, each with an observed child Yi, and the query is Xn. Eliminating Z first joins a table over Z,X1,…,Xn, then leaves 2n entries. Eliminating the other Xi first instead reduces each branch to a factor over Z; the largest joined scope is just Z,Xi, with four entries.

A polytree has at most one undirected path between any two nodes. With a good order, inference is linear in total CPT size. General exact inference and finding the optimal elimination order are NP-hard. A practical heuristic chooses a variable creating a small next factor. Keep the query variable until normalization. Multiplying a whole factor by a positive constant leaves the normalized answer unchanged.

Key Takeaways

  • Restrict evidence before eliminating hidden variables.
  • Join every factor containing a variable before summing it out.
  • Intermediate factors need not be probability distributions.
  • Elimination order changes cost while preserving the exact answer.
  • The largest intermediate scope drives table size.
  • A good order makes polytree inference linear in CPT size.
4

Approximate answers by sampling

Sampling estimates a probability by generating assignments instead of evaluating every hidden combination. The methods differ in how they use observations: filtering prior samples, weighting assignments with fixed evidence, or repeatedly resampling a local conditional distribution. Working through individual draws makes their estimators clear and shows why rare evidence, uneven weights and correlated states affect accuracy.

4.1 Generate samples and keep the matching ones

When exact sums are too expensive, an agent can simulate assignments and estimate probabilities from their frequencies. Sampling produces an approximation whose quality depends on how much useful information the draws contain.

Turn a random number into a value

Draw a uniform number u from [0,1). Split that interval into pieces with lengths equal to the probabilities. For weather probabilities ⟨0.5,0.3,0.2⟩, sun occupies [0,0.5), cloud [0.5,0.8) and rain [0.8,1). A draw of 0.63 gives cloud. For a Boolean variable, choose true if the draw is less than its true probability.

Sample parents before children

Prior sampling visits variables in topological order. Each node is sampled from the CPT row selected by its parents' sampled values. The word "prior" refers to drawing from the network before conditioning the sample population on query evidence.

In the commute model, use order R,A,T,L,U and draws 0.13, 0.57, 0.40, 0.81 and 0.35:

  1. Rain is true because 0.13<0.2.
  2. Accident is false because 0.57≥0.1.
  3. Traffic is true because 0.40<P(t∣r,¬a)=0.7.
  4. Late is false because 0.81≥P(l∣t)=0.6.
  5. Umbrella is true because 0.35<P(u∣r)=0.9.

The assignment is (r,¬a,t,¬l,u). Its generation probability is 0.2(0.9)(0.7)(0.4)(0.9)=0.04536, exactly its probability under the network's joint distribution. Sampling a child before its parents would leave the needed CPT row undecided.

Estimate probabilities from counts

The fraction of prior samples with lateness estimates P(l), which is 0.2765 in this model. The estimator is consistent: as the number of independent draws grows, it converges to the true probability. A larger run can still fluctuate. Typical independent-sample error scales as 1/N, so four times as many samples roughly halves the error; twice as many does not.

Condition with rejection sampling

Rejection sampling generates prior assignments and discards those that contradict the evidence. Count query values only among the retained assignments. For example, suppose 280 of 1,000 assignments have lateness and 94 of those also have rain. Then P(r∣l)≈94/280≈0.336. Dividing by 1,000 would estimate the joint event rain-and-lateness instead.

A sample may be abandoned as soon as it conflicts with an observation, saving the remaining simulation work. The expected retained fraction is still P(e). Lateness alone retains about 28%; lateness with an umbrella retains about 12%, since P(l,u)=0.12005. Many observations can make the evidence combination rare even when each observation is ordinary on its own. If no samples survive, the conditional estimate is undefined and more useful sampling is needed.

Key Takeaways

  • Prior sampling visits parents before children.
  • Each full assignment is generated with its joint probability.
  • Rejection sampling divides query matches by retained samples.
  • The expected acceptance fraction equals the evidence probability.
  • Four times as many independent samples roughly halves typical error.

4.2 Weight samples while fixing the evidence

Rejection sampling spends time creating assignments it cannot use. Likelihood weighting keeps every evidence variable fixed and compensates with a weight. Samples whose hidden values make the evidence likely contribute more.

Build a weighted assignment

Start each sample with weight 1. Visit nodes in topological order. Sample a non-evidence node using its parents' current values. At an evidence node, retain its observed value and multiply the weight by that value's CPT probability:

w=∏iP(ei∣parents(Ei)).

Only evidence probabilities enter this weight. The probabilities of the sampled nodes already govern how frequently their assignments are generated. Multiplying those probabilities into the weight would count them twice.

Two samples in the commute model

For P(R∣l,u), keep lateness and umbrella true. Sample rain, accident and traffic. The traffic probabilities for (r,a),(r,¬a),(¬r,a),(¬r,¬a) are 0.95, 0.7, 0.8 and 0.2, with priors P(r)=0.2 and P(a)=0.1.

Using draws 0.13, 0.57 and 0.40 gives rain, no accident and heavy traffic. The fixed lateness contributes P(l∣t)=0.6; the fixed umbrella contributes P(u∣r)=0.9. The sample's weight is 0.6(0.9)=0.54.

Draws 0.66, 0.05 and 0.92 instead give no rain, an accident and no heavy traffic. The evidence likelihoods are now P(l∣¬t)=0.1 and P(u∣¬r)=0.2, so the weight is 0.02. Both samples match the evidence because those values were fixed, yet their contributions differ greatly.

Normalize weights, not sample counts

Estimate a query probability by

P^(x∣e)=∑j:Xj=xwj∑jwj.

The two-sample rain estimate is 0.54/(0.54+0.02)≈0.964. That is far from the exact posterior of about 0.693; two draws are too few to represent the relevant hidden assignments. With many draws, the weighted ratio converges to the posterior. Dividing 0.54 by two would not produce a conditional probability estimate.

The correction works because multiplying the sampling probability by the evidence weight recovers the full joint product. Normalizing removes the shared evidence probability and leaves the conditional distribution.

Recognize concentrated weights

Fixed evidence affects how its descendants are sampled, since they use that evidence in their parent rows. Upstream variables are still drawn without feedback from downstream observations. If rare evidence sits at leaf nodes, most upstream assignments may explain it poorly. Their weights are tiny, and a few assignments can dominate the result.

Likelihood weighting often uses computation more efficiently than rejection sampling, but "no rejected samples" does not mean equally informative samples. A long run with highly uneven weights can still give an unstable estimate. Inspect which assignments carry the total weight when comparing results across runs.

Key Takeaways

  • Fix evidence and sample only the remaining variables.
  • Weights multiply evidence likelihoods, not sampled-node probabilities.
  • Divide a query's accumulated weight by the total weight.
  • Rare downstream evidence can concentrate nearly all weight in a few samples.

4.3 Resample locally with Gibbs sampling

Gibbs sampling keeps a complete assignment and changes one non-evidence variable at a time. Each change is drawn from the variable's conditional distribution given the current values of all other variables. The sequence forms a Markov chain Monte Carlo, or MCMC, sampler.

Start a chain and keep evidence fixed

Set evidence to its observed values and initialize the remaining variables. With deterministic zeros, start from an evidence-compatible assignment with positive joint probability. Choose a non-evidence variable to update, calculate a probability for each of its possible values, normalize, and draw the new value. All other values stay in place for that step. Repeating this process allows evidence to affect upstream as well as downstream beliefs.

Only the selected node's Markov blanket is needed: its parents, children and children's other parents. Factors outside that blanket do not change when the selected value changes, so they cancel in normalization. The local formula is

P(x∣mb(X))=αP(x∣parents(X))∏Y∈children(X)P(y∣parents(Y)).

Children keep their current values while each candidate value of the selected parent is tried. Their CPT entries can therefore change even though the children themselves are not resampled.

Update rain in the commute model

Keep lateness and umbrella true. Suppose the current hidden state is no rain, no accident and heavy traffic. Rain's blanket is traffic, umbrella and accident. For rain true, the local score is

P(r)P(u∣r)P(t∣r,¬a)=0.2(0.9)(0.7)=0.126.

For rain false, the score is 0.8(0.2)(0.2)=0.032. Normalizing gives P(r∣blanket)=0.126/0.158≈0.797. A uniform draw of 0.40 therefore changes rain to true. Lateness's factor is absent from this update because traffic stays fixed and that factor is constant across the two rain candidates.

Update traffic with the new rain value

Traffic's blanket is rain, accident and lateness. Its two scores are 0.7(0.6)=0.42 for heavy traffic and 0.3(0.1)=0.03 for no heavy traffic. Thus its true probability is 0.42/0.45≈0.933. For an accident update with rain and heavy traffic fixed, the true probability is 0.095/(0.095+0.63)≈0.131.

Count states and allow time to mix

After each update, the full assignment can count as a sample, including a step that leaves the selected value unchanged. Discard an initial burn-in period to reduce the influence of initialization. A long-run rain frequency approaches about 0.693 for this query when the chain converges.

Adjacent states share nearly all their values and are correlated. They carry less independent information than the same number of independent draws. With all CPT entries strictly between 0 and 1, suitable repeated updates can reach every state and converge to the posterior. Deterministic constraints can trap a single-variable chain; nearly deterministic relationships can make it move very slowly.

Prior sampling draws from the joint; rejection filters those draws; likelihood weighting fixes evidence and weights assignments; Gibbs repeatedly updates a fixed-evidence state. Conditioning only on parents would turn a Gibbs update into the wrong local distribution by omitting children's evidence.

Key Takeaways

  • Gibbs sampling changes one non-evidence variable at a time.
  • Use the node's own CPT and all its children's CPTs.
  • Normalize scores across the candidate values before drawing.
  • Consecutive states are correlated.
  • Burn-in reduces dependence on the arbitrary starting assignment.
  • Deterministic constraints can prevent a chain from reaching all relevant states.
5

Make decisions with utilities, decision networks and the value of information

A useful agent must choose what to do as well as estimate what is true. Utilities express preferences over outcomes, and expected utility connects those preferences to uncertain actions. Decision networks organize the available information, possible choices and their consequences. Comparing the best action before and after an observation then shows whether gathering more information is worth its cost.

5.1 Choose actions by expected utility

Probabilities describe what may happen; utilities describe how desirable the outcomes are. A utility function assigns higher numbers to preferred outcomes. An uncertain action is a lottery, listing outcomes and their probabilities.

Average utility across possible outcomes

The expected utility of an action is

EU(a∣e)=∑sP(s∣a,e)U(s).

Multiply each outcome's utility by its probability and add. Maximum expected utility (MEU) chooses the action with the largest result. The outcome with the highest individual utility need not belong to the best action, and the most likely outcome alone does not determine the choice. A sound decision can still produce a bad outcome through chance.

Why coherent preferences support MEU

Utility theory uses these rationality requirements:

  • Orderability: any two lotteries can be compared, allowing indifference.
  • Transitivity: preferring A to B and B to C entails preferring A to C.
  • Continuity: an intermediate outcome can be matched by a lottery between better and worse outcomes.
  • Substitutability: an indifferent outcome or lottery can replace another within a larger lottery.
  • Monotonicity: between lotteries with the same better and worse outcomes, prefer the larger probability of the better outcome.
  • Decomposability: a lottery over lotteries reduces to its final outcome probabilities.

The von Neumann–Morgenstern result represents preferences satisfying these requirements by expected utility. Cyclic preferences violate transitivity. If an agent pays a small amount to move from B to A, A to C and C to B, repeated trades return it to its original position while draining its money. This is the "money pump" problem.

Money and utility can rank lotteries differently

Compare a sure payment of 400 with a 50% chance of 1,000 and a 50% chance of zero. Expected money favors the lottery, whose mean is 500. For U(x)=x, however, the lottery's expected utility is 0.51000+0.50≈15.81, while the sure payment gives 20. This agent chooses 400.

The certainty equivalent is the sure amount with the lottery's utility. Here it is (0.51000)2=250. The difference between expected money and the certainty equivalent is the risk premium, 250 in this example.

Utility of moneyRisk attitude
ConcaveRisk-averse
LinearRisk-neutral
ConvexRisk-seeking

With concave utility, a sure mean amount is at least as desirable as the lottery with that mean. Strict concavity makes that preference strict for a nontrivial lottery. A sufficiently favorable risky option can still beat a less valuable sure amount.

Change scales without changing preferences

Replacing utility by U′(s)=kU(s)+c with k>0 preserves every expected-utility comparison. Each expectation receives the same positive scaling and shift. A general increasing transformation preserves rankings of certain outcomes but can change rankings of lotteries.

When comparing several desirable attributes, an option at least as good on every attribute and better on at least one dominates the other. With preferences that value those improvements, the dominated option can be removed without specifying exact attribute weights.

Key Takeaways

  • Expected utility weights every outcome's utility by its probability.
  • MEU evaluates a choice using available information, not the eventual luck.
  • Coherent lottery preferences can be represented by expected utility.
  • Money and utility need not have the same scale or curvature.
  • A certainty equivalent matches a lottery's expected utility.
  • Positive affine utility transformations preserve choices.
  • Dominance can eliminate an inferior option before detailed weighting.

5.2 Turn observations into a decision policy

A decision network, also called an influence diagram, combines a probability model with choices and preferences. Solving it requires both inference about uncertain states and comparison of the actions available to the agent.

Read the three node types

Chance nodes, usually ovals, have probability tables. Decision nodes, usually rectangles, represent actions the agent controls. Utility nodes, usually diamonds, assign utility to combinations of parent values. An arrow into a decision node identifies information available when the choice is made. It is not an ordinary conditional-probability dependency.

For an outdoor event, rain influences a forecast and the event's utility. The action also influences utility. The forecast points into the decision when it is observed before the organizer chooses. There is no arrow from the action to rain: moving indoors does not change the weather.

Solve without a forecast

Suppose P(rain)=0.3, and use this utility table:

ActionNo rainRain
Outdoors1000
Indoors6070

The expected utilities are EU(outdoors)=0.7(100)+0.3(0)=70 and EU(indoors)=0.7(60)+0.3(70)=63. Without further information, choose outdoors and the MEU is 70. The decision node receives a chosen value, not a probability table to average over actions.

Incorporate a forecast

Let P(wet∣rain)=0.8 and P(wet∣¬rain)=0.1. The wet forecast probability is 0.8(0.3)+0.1(0.7)=0.31. Bayes' rule gives P(rain∣wet)=0.24/0.31≈0.774. A dry forecast gives P(rain∣dry)=0.06/0.69≈0.087.

With a wet forecast, outdoors has expected utility about 22.6 and indoors about 67.7, so choose indoors. With a dry forecast, outdoors gives about 91.3 and indoors about 60.9, so choose outdoors. Use the posterior after an observation; retaining the prior would discard the information the forecast supplies.

The resulting policy is "Choose indoors after wet; choose outdoors after dry." A policy maps observations to actions, so it can be specified before the observation arrives. An action is the single choice made once its information is available.

Find where the choice changes

Let p be the current probability of rain. Then EU(outdoors)=100(1−p) and EU(indoors)=60(1−p)+70p=60+10p. Equating them gives 40=110p, or p=4/11≈0.364. Below this threshold choose outdoors; above it choose indoors; at the threshold the actions tie.

To solve another decision network, fix the current evidence, consider each action in turn, infer the chance distribution relevant to utility, and calculate its expected utility. If an action changes an uncertain outcome, include that action's effects in the probability model before comparing expectations. Finally select the best action separately for each possible observation that the policy will receive.

Key Takeaways

  • Chance, decision and utility nodes play different roles.
  • An incoming decision arrow marks information known before choosing.
  • Evaluate every action with the posterior for the available evidence.
  • A policy maps observations to actions.
  • Equating expected utilities identifies a decision threshold.

5.3 Work out what an observation is worth

An observation is valuable when it helps the agent choose a better action. The value of perfect information (VPI) measures the expected improvement from learning a variable's value before acting. "Perfect" describes access to that variable's actual value; the variable can itself be an imperfect forecast of something else.

Optimize within each possible observation

Given current evidence e, the value of observing E′ is

VPI(E′∣e)=∑e′P(e′∣e)MEU(e,e′)−MEU(e).

First find the best expected utility of deciding now. Next, for every possible observation, update the probabilities and choose the best action for that observation. Average these optimized utilities using the observation probabilities. Subtract the current MEU. Choosing one action first and then averaging would miss the ability to adapt the action.

Value the forecast and the weather

For the event model, choosing outdoors without a forecast gives MEU 70. Wet forecasts occur with probability 0.31 and lead to indoors, with MEU about 67.74. Dry forecasts occur with probability 0.69 and lead to outdoors, with MEU about 91.30. Carrying exact values gives

0.31MEU(wet)+0.69MEU(dry)=21+63=84.

Thus VPI(F)=84−70=14 utility units. A cost expressed as a utility loss below 14 makes obtaining the forecast worthwhile; at 14 the agent is indifferent. A money price must first be evaluated on the agent's utility scale.

Knowing the weather itself is more useful. Rain leads to indoors with utility 70; no rain leads to outdoors with utility 100. The average is 0.3(70)+0.7(100)=91, so VPI(Rain)=91−70=21.

Why information has nonnegative expected value

The agent can always ignore free information and keep its original action. Optimizing after observing can therefore never reduce expected utility before the observation is known. If the same action is best for every possible result, information has zero value. Information independent of all utility-relevant chance variables, given current evidence, also has zero value in this decision model.

A particular result can still be unwelcome. After a wet forecast, MEU is about 67.7, below the earlier 70. Nonnegativity concerns the average over all results before seeing them.

Combine information without double counting

VPI is generally nonadditive. The forecast alone is worth 14 and the weather alone 21, yet learning both is worth 21 because the forecast adds nothing after weather is known.

After wet, learning weather adds about 9.03; after dry, it adds about 6.09. Before seeing the forecast, the expected extra value is 0.31(9.03)+0.69(6.09)≈7. Hence the joint gain is 14+7=21, equal to learning weather first and then adding zero. The total is order-independent when all observations precede the action, with each later gain evaluated using the earlier information.

An information-gathering agent may repeatedly choose the observation with the greatest positive VPI minus cost, then act when none remains worthwhile. This myopic strategy evaluates one observation at a time. Two observations can be useful together even when neither alone changes the best action, so greedy selection can miss a valuable pair.

Key Takeaways

  • Average the best action for each observation, then subtract the current MEU.
  • VPI is measured before the observation is known.
  • Free information has nonnegative expected value because it can be ignored.
  • A specific result can lower the posterior MEU.
  • Several observations can share information, so their separate VPIs need not add.
  • Compare information cost on the same utility scale as its benefit.

Bayesian Networks examples

5 Walkthroughs

1

From a joint table to an updated belief

14 steps
Read possible worlds, condition on an observation, apply Bayes' rule and use conditional independence.
  1. 1
    IntroductionStart with possible worlds

    An agent can be uncertain about several things at once. Begin with a joint table that assigns probability to every combination, then ask how an observation changes the relative probabilities.

    The route is: describe worlds, keep the observed ones, normalize, and look for independence that simplifies the next calculation.

  2. 2
    ExplanationGive each combination one probability

    Weather has values sun, cloud and rain; Bus has values on time and late. Together they give six worlds. Their joint probabilities are 0.40 and 0.10 for sun, 0.18 and 0.12 for cloud, and 0.08 and 0.12 for rain, in on-time/late order.

    All six entries sum to 1. A row need not sum to 1 because it covers only one weather value.

  3. 3
    ExampleAdd the worlds an event includes

    To find rain's probability, add both bus possibilities: 0.08+0.12=0.20. To find lateness, add across all three weather values: 0.10+0.12+0.12=0.34.

    This is marginalization. The variable being removed ranges over all its values; the retained variable keeps a separate total for each value.

  4. 4
    ChallengeFind a union without double counting

    Using rain probability 0.20, lateness probability 0.34 and their joint probability 0.12, find the probability of rain or lateness.

    ---reveal---

    0.20+0.34−0.12=0.42.

    The rainy, late world appears in both marginals. Subtracting its probability once leaves each world in the union counted exactly once.

  5. 5
    ExplanationKeep only the observed column

    The bus is late. The surviving weather totals are now 0.10 for sun, 0.12 for cloud and 0.12 for rain. They sum to 0.34, the probability of lateness.

    Divide each by 0.34 to obtain P(Weather∣late)≈⟨0.294,0.353,0.353⟩. The new probabilities describe shares within the observed population, so they sum to 1.

  6. 6
    ChallengeReverse the conditional question

    The rainy, late joint probability is 0.12, and the rain marginal is 0.20. What is P(late∣rain)? Why is its denominator different from the preceding rain-given-late calculation?

    ---reveal---

    P(late∣rain)=0.12/0.20=0.6.

    Rain is now the evidence, so the comparison population is all rainy worlds. Rain given late instead divides by the late marginal 0.34.

  7. 7
    ConnectionTurn conditioning into a product

    Rearranging conditional probability gives P(a,b)=P(a∣b)P(b). Repeating that identity yields the chain rule, with each variable conditioned on the earlier variables.

    For a hidden-variable query, use the same joint probabilities: select evidence-compatible worlds, add over hidden values and normalize. Independence is not needed to justify either the product rule or enumeration.

  8. 8
    ExampleWeight a positive result by its prior

    An illness has prior probability 0.01. A test is positive with probability 0.9 under illness and 0.05 otherwise.

    The ill-and-positive score is 0.01(0.9)=0.009. The healthy-and-positive score is 0.99(0.05)=0.0495. These two routes account for all positives; their sum is 0.0585.

  9. 9
    ExampleNormalize the competing explanations

    Bayes' rule divides the ill-and-positive score by all positives:

    P(ill∣+)=0.009/0.0585≈0.154.

    In 10,000 people, 90 ill people and 495 healthy people test positive. Only 90 of the 585 positive results belong to ill people. The low base rate matters because the healthy group is much larger.

  10. 10
    ChallengeInterpret a second positive

    A second test is conditionally independent of the first given illness status and has the same likelihoods. How should its positive result update the first posterior?

    ---reveal---

    Use the first posterior as the next prior. Equivalently, the two scores are 0.01(0.9)2=0.0081 and 0.99(0.05)2=0.002475. Normalizing gives about 0.766. Reusing the original prior for only the second result would discard the first observation.

  11. 11
    ExplanationHold the class fixed before multiplying

    In the flu model, cough probability is 0.7 with flu and 0.2 without flu, whether or not fever is present. Fever and cough are conditionally independent given flu status.

    Without fixing flu, fever changes the cough probability because it changes belief about flu. Naive Bayes uses this class-conditioned independence to multiply feature likelihoods, not their unconditional marginals.

  12. 12
    ExampleScore both classes

    For spam, the prior is 0.3. The word "offer" has likelihood 0.4 in spam and 0.05 in ham; "winner" has likelihood 0.2 and 0.01.

    With both words present, scores are 0.3(0.4)(0.2)=0.024 and 0.7(0.05)(0.01)=0.00035. Divide the spam score by their sum to obtain about 0.986. A class score alone is not yet a posterior.

  13. 13
    ChallengeUpdate when a feature is absent

    Keep the same spam model, but the email contains "offer" and not "winner." Find the spam posterior.

    ---reveal---

    Use complementary winner likelihoods. Spam scores 0.3(0.4)(0.8)=0.096; ham scores 0.7(0.05)(0.99)=0.03465. Normalize to get 0.096/0.13065≈0.735. The absent word is evidence, so dropping its factor would answer a different question.

  14. 14
    RecapChoose the right probability operation

    A joint table describes complete worlds. Marginalization removes a variable by adding; conditioning fixes an observation and normalizes. Bayes' rule reverses a conditional by including both likelihood and prior.

    Independence shortens a calculation only under the condition where it holds. Keep those conditions attached when multiplying evidence likelihoods.

2

Read a network and trace its paths

12 steps
Use local tables, identify a Markov blanket and decide which paths the evidence blocks.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionConnect tables to graph structure
  2. 2
    ExplanationRead the commute arrows
  3. 3
    ExampleSelect one entry at every node
  4. 4
    ChallengeCount the model's free probabilities
  5. 5
    ExplanationFind the variables that screen off Rain
  6. 6
    ChallengeApply independent causal failures
  7. 7
    Key InsightAn omitted parent makes a claim
  8. 8
    ExplanationSeparate non-colliders from colliders
  9. 9
    ExampleWatch an effect connect its causes
  10. 10
    ChallengeObserve a collider's descendant
  11. 11
    ChallengeBlock a different part of the same path
  12. 12
    RecapUse the graph for two different tasks
3

Compute one posterior in two exact ways

11 steps
Evaluate rain given lateness by enumeration and variable elimination, then compare factor sizes.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionKeep the answer fixed while changing the arithmetic
  2. 2
    ExplanationIdentify what is hidden
  3. 3
    ExampleSum hidden alternatives under rain
  4. 4
    ChallengeFinish the conditional distribution
  5. 5
    ExplanationRestrict factors to the evidence
  6. 6
    ExampleEliminate Accident first
  7. 7
    ExampleEliminate Traffic and retain Rain
  8. 8
    ChallengeCollect all factors before a sum
  9. 9
    Key InsightMeasure the largest joined scope
  10. 10
    ChallengeAdd an observed leaf back into the calculation
  11. 11
    RecapKeep the probability roles visible
4

Compare four ways to sample

14 steps
Generate a prior assignment, filter or weight evidence, then update a Gibbs state from local scores.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionDecide what counts as a sample
  2. 2
    ExplanationSample using the current parent row
  3. 3
    ExampleComplete one joint draw
  4. 4
    ChallengeUse the survivors as the denominator
  5. 5
    TipMeasure useful draws, not only total draws
  6. 6
    ExplanationFix observed values and accumulate their likelihood
  7. 7
    ExampleCompare the influence of two samples
  8. 8
    ChallengeDiagnose a concentrated-weight run
  9. 9
    ExplanationUpdate one variable while keeping the rest
  10. 10
    ExampleCompute Rain's two local scores
  11. 11
    ChallengePass the new state into the next update
  12. 12
    Key InsightA long chain must also move
  13. 13
    ChallengeChoose an estimator for each log
  14. 14
    RecapMatch generation to estimation
5

From uncertain outcomes to the value of a forecast

15 steps
Compare utilities, choose an event policy after a forecast and calculate the expected gain from observing it.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionSeparate belief from preference
  2. 2
    ExplanationAverage outcome utilities
  3. 3
    ExampleCheck the utility scale before choosing
  4. 4
    ChallengeRescale without changing the choice
  5. 5
    ExplanationSet up the event decision
  6. 6
    ExampleChoose before receiving a forecast
  7. 7
    ExampleUpdate after a wet forecast
  8. 8
    ChallengeComplete the observation-dependent policy
  9. 9
    ExplanationAverage decisions made with information
  10. 10
    ChallengeSubtract what the agent already has
  11. 11
    Key InsightAn unwelcome result can still be worth learning
  12. 12
    ExampleCompare a forecast with knowing the weather
  13. 13
    ChallengeValue a second observation conditionally
  14. 14
    ConnectionKnow when greedy observation choice can fail
  15. 15
    RecapEvaluate the policy before paying for information

Bayesian Networks practice questions

60 Practice Questions in 6 sets

Set 1: Represent dependencies and test paths10 Practice Questions

Question 1 of 10

Three active causes in a noisy-OR have inhibition probabilities 0.1, 0.5 and 0.4, with no leak. What is the effect probability?
  1. 0.02
  2. 0.90
  3. 0.20
  4. 0.98
Show answerHide answer
Answer: D
All three causes must fail for the effect to be absent, giving 0.1(0.5)(0.4)=0.02. The effect probability is its complement, 0.98. Returning 0.02 confuses the independent failure product with the probability that at least one cause produces the effect.

Question 2 of 10

In the chain A→B→C, what observation d-separates A from C?
  1. Observing no variable.
  2. Observing B.
  3. Observing a child of C.
  4. Observing a child of B.
Show answerHide answer
Answer: B
The only path passes through B as a non-collider, so observing B blocks it. Observing a descendant of B does not block this chain: descendant evidence opens colliders, but a chain needs its middle node itself to be observed for this separation.

Question 3 of 10

A Boolean node has three Boolean parents. How many free probabilities does its unrestricted CPT require?
  1. 3
  2. 6
  3. 8
  4. 16
Show answerHide answer
Answer: C
There are 23=8 assignments of the parents. Each row needs one freely chosen true probability because the false probability is its complement. Sixteen counts both values in every row, even though each pair must add to 1.

Question 4 of 10

A network is Power→Sensor→Alert. It has P(p)=0.8, P(s∣p)=0.9 and P(a∣¬s)=0.15. What is P(p,¬s,a)?
  1. 0.012
  2. 0.108
  3. 0.120
  4. 0.072
Show answerHide answer
Answer: A
Select the false-sensor entry under power: P(¬s∣p)=0.1. The complete assignment has probability 0.8(0.1)(0.15)=0.012. Multiplying by 0.9 would describe the sensor being true, even though the requested world fixes it to false.

Question 5 of 10

A root has P(h)=0.25. Its child has P(c∣h)=0.8 and P(c∣¬h)=0.2. What is the child's marginal true probability?
  1. 0.20
  2. 0.50
  3. 0.80
  4. 0.35
Show answerHide answer
Answer: D
Average the child's two rows using the root probabilities: 0.25(0.8)+0.75(0.2)=0.35. A simple average of the row values gives 0.50 and treats the root states as equally likely, contradicting the stated prior.

Question 6 of 10

In A→C←B and C→D, what is the Markov blanket of A?
  1. {C}
  2. {B,C}
  3. {C,D}
  4. {B,C,D}
Show answerHide answer
Answer: B
A's child is C, and that child's other parent is B. These two nodes form A's Markov blanket. Including D would add a grandchild that is screened off once C is fixed; omitting B would lose the dependence through the observed common child.

Question 7 of 10

The graph is H→J←K and J→M. With only M observed, is independence between H and K guaranteed?
  1. No; observing M opens the collider at J.
  2. Yes; J itself is not observed.
  3. Yes; arrows cannot be followed from H to K.
  4. No; unobserved colliders are always open.
Show answerHide answer
Answer: A
M is a descendant of the collider J, so observing M activates the H–J–K path. Independence is no longer guaranteed. It is unnecessary to observe J itself; evidence about a downstream effect can also connect the two possible upstream explanations.

Question 8 of 10

The graph has A→B→D and A→C→D. Does observing B guarantee independence of A and D?
  1. Yes; B blocks every directed route.
  2. Yes; conditioning blocks the shared endpoint.
  3. No; the path through C remains active.
  4. No; observing B opens the path through B.
Show answerHide answer
Answer: C
Observing B blocks the path A–B–D, but A–C–D still has an unobserved non-collider C. d-separation requires every path to be blocked. Checking only the route through the observed node overlooks the second way information can pass between the endpoints.

Question 9 of 10

The graph is Q←A→C←B→R and C→E. Given A and E, are Q and R d-separated?
  1. No; E opens the whole path through C.
  2. Yes; A blocks the path despite E opening C.
  3. Yes; observing E closes the collider at C.
  4. No; conditioning on A opens the fork.
Show answerHide answer
Answer: B
E opens the collider C because it is a descendant of C. The same path still contains the observed non-collider A, which blocks it, and there is no second route. Opening a collider removes one block; it does not cancel a separate block elsewhere on the path.

Question 10 of 10

A graph leaves an active path between X and Y given Z. What can be concluded without the CPT values?
  1. Independence is not guaranteed by the graph.
  2. X and Y must be dependent for every CPT.
  3. X and Y must be independent for every CPT.
  4. The graph cannot represent a joint distribution.
Show answerHide answer
Answer: A
An active path allows dependence for some distributions compatible with the graph. Special table values can still make the variables independent, so definite dependence requires more than this graph test. d-separation supplies universal independence guarantees; failure of the test removes that guarantee.
Set 2: Read evidence and update beliefs10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

A naive Bayes model has P(C)=0.4, P(x∣C)=0.6, P(x∣¬C)=0.2, P(y∣C)=0.3 and P(y∣¬C)=0.7. What is P(C∣x,¬y)?
  1. 0.824
  2. 0.462
  3. 0.168
  4. 0.933
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

A sorting model assigns probabilities 0.22 to "red and damaged" and 0.18 to "red and intact." What is the marginal probability of red?
  1. 0.04
  2. 0.40
  3. 0.22
  4. 0.60
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

For a device, P(hot)=0.45, P(noisy)=0.30 and P(hot,noisy)=0.12. What is the probability that it is neither hot nor noisy?
  1. 0.25
  2. 0.63
  3. 0.87
  4. 0.37
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

How many free probabilities are needed for an unrestricted joint distribution over four Boolean variables?
  1. 15
  2. 4
  3. 8
  4. 16
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

A file model has P(corrupt,flag)=0.06 and P(intact,flag)=0.14. What is the probability of corruption given a flag?
  1. 0.06
  2. 0.20
  3. 0.30
  4. 0.70
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

For variables A, B and C, what chain-rule expression equals P(a,b,c) in that order?
  1. P(a)P(b)P(c)
  2. P(a)P(b∣a)P(c∣a,b)
  3. P(a)P(b∣a)P(c∣b)
  4. P(a∣b)P(b∣c)P(c∣a)
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

A component is defective with probability 0.04. A warning appears with probability 0.80 if defective and 0.10 otherwise. What is the probability of a defect after a warning?
  1. 0.040
  2. 0.320
  3. 0.250
  4. 0.800
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

A screening process has sensitivity 0.85 and false-positive rate 0.15. Both stay fixed. How does the fault posterior after a positive result change when the prior fault probability increases?
  1. It increases.
  2. It stays fixed.
  3. It decreases.
  4. It equals sensitivity.
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

A parcel contains a restricted item with prior probability 0.05. Each of two detectors is positive with probability 0.9 if it does and 0.2 otherwise. Their results are conditionally independent given item status. After both are positive, what is the posterior?
  1. 0.191
  2. 0.810
  3. 0.096
  4. 0.516
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

Two events each have probability 0.5 and cannot occur together. Are they independent?
  1. Yes; their probabilities are equal.
  2. Yes; neither changes the other.
  3. No; their joint is 0, not 0.25.
  4. No; their joint must equal 0.5.
Show answerHide answer

Save this lesson to see this answer.

Set 3: Calculate posteriors with factors10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

A query is P(Q∣b) in the graph A→B→Q with an additional child B→Z. Which hidden variable lies outside the ancestors of the query and evidence?
  1. A
  2. Z
  3. B
  4. Q
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

A Boolean hidden variable H produces unnormalized query totals 0.03+0.09 for q and 0.08+0.10 for ¬q. What is P(q∣e)?
  1. 0.12
  2. 0.30
  3. 0.40
  4. 0.60
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

A network is H→S and H→T, with P(h)=0.3, P(s∣h)=0.8, P(s∣¬h)=0.2, P(t∣h)=0.6 and P(t∣¬h)=0.1. What is P(s∣t)?
  1. 0.632
  2. 0.800
  3. 0.380
  4. 0.158
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

Restrict the CPT P(E∣A,B) to the observation E=false. What variables remain in the factor scope?
  1. E,A,B
  2. E
  3. A
  4. A,B
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

A factor has f(h,x)=0.3 and f(¬h,x)=0.7. Another has g(h)=0.4 and g(¬h)=0.2. What entry results for x after joining the factors and eliminating H?
  1. 0.60
  2. 1.00
  3. 0.26
  4. 0.12
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

The current factors are f(A,B), g(B,C), h(C) and j(A). What factor replaces the factors involving B when B is eliminated?
  1. k(A,C)=(∑bf(A,b))(∑bg(b,C))
  2. k(A,C)=∑bf(A,b)g(b,C)
  3. k(A)=∑bf(A,b)
  4. k(C)=∑bg(b,C)
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

Boolean Z is the parent of five hidden Boolean leaves X1,…,X5. The query is Z. Compare eliminating the leaves first with eliminating Z first. What order is valid and keeps the query?
  1. Eliminate the five leaves; keep Z.
  2. Eliminate Z, then the five leaves.
  3. Eliminate Z, then reconstruct its prior.
  4. Eliminate every variable, then normalize.
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

Boolean H points to four hidden Boolean nodes Xi, each with an observed child Ei. The query is X4. If H is eliminated before any Xi, how many entries does the resulting factor over the Xi have?
  1. 4
  2. 8
  3. 32
  4. 16
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

Factors are f(A,B), g(B,C) and h(C,D) over Boolean variables; query variables are A and D. Which first elimination gives the smaller joined factor: B or C?
  1. B: its joined factor has 4 entries.
  2. They tie: either joined factor has 8 entries.
  3. C: its joined factor has 4 entries.
  4. They tie: either joined factor has 16 entries.
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

An implementation multiplies every entry of one factor by 7 before finishing variable elimination. How does this change the final normalized posterior?
  1. It multiplies each posterior entry by 7.
  2. It divides each posterior entry by 7.
  3. It makes the posterior uniform.
  4. It leaves the posterior unchanged.
Show answerHide answer

Save this lesson to see this answer.

Set 4: Estimate probabilities from useful samples10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

A variable has probabilities 0.2 for low, 0.5 for medium and 0.3 for high, in that cumulative order. What value does a uniform draw of 0.68 select?
  1. Low.
  2. High.
  3. Low or medium.
  4. Medium.
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

Of 2,400 prior samples, 120 match the evidence and 42 of those match the query value. What is the rejection estimate?
  1. 0.3500
  2. 0.0175
  3. 0.0500
  4. 0.6500
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

Evidence has probability 0.003. About how many matches should be expected among 20,000 independent prior samples?
  1. 6
  2. 600
  3. 60
  4. 2000
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

An independent sampler increases its run from 900 to 8,100 draws. By what factor does typical error shrink?
  1. To one ninth.
  2. To one third.
  3. To one half.
  4. To three times.
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

Two fixed evidence nodes have likelihoods 0.3 and 0.8 under a sampled assignment. The sampled root had prior probability 0.2. What is the likelihood-weighting weight?
  1. 0.048
  2. 0.24
  3. 0.16
  4. 0.30
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

Three likelihood-weighted samples have weights 0.15, 0.05 and 0.30. The first two have the query value true. What is the estimate of its posterior probability?
  1. 0.20
  2. 0.67
  3. 0.40
  4. 0.10
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

A fault is rare, and several almost deterministic downstream alarms are observed. Rejection sampling retains few draws, while likelihood weighting produces mostly tiny weights. What shared feature explains both problems?
  1. Prior draws rarely choose fault states that explain the alarms.
  2. Fixing alarms makes every upstream draw a posterior draw.
  3. The alarms force both samplers to resample all evidence.
  4. Tiny evidence probabilities make normalized estimates exceed 1.
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

During Gibbs sampling of P(X,Y∣z), which variables are eligible for resampling?
  1. X, Y and Z.
  2. Z only.
  3. X only.
  4. X and Y only.
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

The graph is H→S, with P(h)=0.4, P(s∣h)=0.9 and P(s∣¬h)=0.2. S is observed true. What probability of true should a Gibbs update use for H?
  1. 0.40
  2. 0.36
  3. 0.75
  4. 0.90
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

Two Boolean variables satisfy a deterministic equality: only (false,false) and (true,true) have positive probability. A single-variable Gibbs chain starts at (false,false). Why can it fail to explore the posterior?
  1. Either one-variable flip enters a zero-probability state.
  2. Its burn-in must equal the number of possible states.
  3. Its samples become independent after one full sweep.
  4. Its local updates require resampling the evidence.
Show answerHide answer

Save this lesson to see this answer.

Set 5: Choose actions and value information10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

Current MEU is 24. A free observation has two outcomes with probabilities 0.4 and 0.6, leading to conditional MEUs 18 and 33. What is its VPI?
  1. 27
  2. 3
  3. 9
  4. 1.5
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

A cargo handler chooses open storage, utilities 50 if dry and −50 if wet, or covered storage, utility 20 either way. Wet probability is 0.2. What is the value of learning wet status exactly before choosing?
  1. 0
  2. 6
  3. 14
  4. 20
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

An action has a 0.7 chance of utility 20 and a 0.3 chance of utility −10. What is its expected utility?
  1. 11
  2. 5
  3. 14
  4. 17
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

An agent has U(x)=x. A lottery pays 900 with probability 0.25 and zero otherwise. What is its certainty equivalent?
  1. 225.00
  2. 7.50
  3. 56.25
  4. 675.00
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

Utilities are replaced by U′=3U−8. How do maximum-expected-utility choices change?
  1. They favor low utility.
  2. They are risk-neutral.
  3. They become risk-averse.
  4. They remain the same.
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

A robot can use route A, with utility 80 if clear and −40 if blocked, or route B, with utility 35 in either state. Its current blocked probability is 0.25. What should it choose?
  1. Route B, with expected utility 35.
  2. Route A, with expected utility 50.
  3. Route A, with expected utility 80.
  4. Route B, with expected utility 26.25.
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

A machine fails with probability 0.2. A red indicator appears with probability 0.75 under failure and 0.1 otherwise. Running has utilities 60 when working and −100 when failed; stopping gives 10. After red, what action maximizes expected utility?
  1. Stop; its utility 10 exceeds running's expected utility.
  2. Run; its expected utility 28 exceeds stopping's 10.
  3. Run; its expected utility 44 exceeds stopping's 10.
  4. Stop; red establishes failure with probability 0.75.
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

A courier chooses express, utility 90 without delay and −30 with delay, or standard, utility 42 in either case. At what delay probability does the best action switch?
  1. 0.35
  2. 0.60
  3. 0.65
  4. 0.40
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

One observation result lowers the current MEU. What does that establish about the VPI before the result was known?
  1. The VPI was negative.
  2. The VPI was zero.
  3. The VPI equals that decrease.
  4. That result alone does not determine the VPI.
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

Two free observations each leave the same action best when seen alone. Together they can reveal a state in which another action is better. What can happen to their joint value?
  1. It must be zero because both separate VPIs are zero.
  2. It can be positive even if each separate VPI is zero.
  3. It must equal the sum of their separate VPIs.
  4. It must be negative because the actions conflict.
Show answerHide answer

Save this lesson to see this answer.

Set 6: Connect inference, sampling and decisions10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

A naive Bayes classifier receives a feature twice because a log entry was duplicated. What modeling issue should be checked before treating the two entries as separate evidence?
  1. Whether their marginal probabilities sum to one.
  2. Whether the class prior is exactly one half.
  3. Whether both likelihoods exceed the prior.
  4. Whether they are conditionally independent given the class.
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

An author changes a network's variable order and keeps each node connected to all earlier variables. Can this still represent the original joint distribution, and what happens to compression?
  1. Yes, and it always uses fewer free parameters.
  2. Yes, but it can lose all independence-based compression.
  3. No, because only a causal order factorizes a joint.
  4. No, because a complete directed order must cycle.
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

The graph is A→C←B, C→D→E and A→F→B. Given D and F, is independence of A and B guaranteed?
  1. No; D opens C even though F blocks the other route.
  2. Yes; F blocks the only active route.
  3. Yes; observing D blocks every route through C.
  4. No; observing F opens its chain.
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

Factors over Boolean variables have scopes {A,H},{H,B},{H,C},{B,C}, with query A. Compare orders H,B,C and B,C,H. What are their largest joined-factor sizes?
  1. 8 and 8
  2. 16 and 16
  3. 16 and 8
  4. 8 and 16
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

Likelihood weighting yields total weight 0.8, of which 0.6 supports q. Another implementation scales every sample weight by 0.01. What query estimate should it return?
  1. 0.0075
  2. 0.60
  3. 0.75
  4. 0.0060
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

A Boolean network is A→B←C with A and C independent roots. B is observed true, C is currently false, P(a)=0.3, P(b∣a,¬c)=0.8 and P(b∣¬a,¬c)=0.1. What probability should a Gibbs update use for A?
  1. 0.300
  2. 0.240
  3. 0.889
  4. 0.774
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

An agent with square-root utility chooses between a sure 100 and a lottery paying 400 with probability 0.2 and zero otherwise. What should it choose?
  1. The sure 100, with utility 10 versus expected utility 4.
  2. The lottery, with expected utility 80 versus utility 10.
  3. The sure 100, with utility 100 versus expected utility 80.
  4. The lottery, with expected utility 20 versus utility 10.
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

A robot's failure prior is 0.1. A warning is observed with likelihood 0.9 under failure and 0.2 otherwise. Continuing gives utilities 70 if sound and −50 if failed; stopping gives 25. What is the best action after the warning?
  1. Stop, because continuing has expected utility −38.
  2. Continue, with expected utility 30.
  3. Continue, with expected utility 58.
  4. Stop, because continuing has expected utility 10.
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

A drone chooses launch, with utility 100 in calm weather and −100 in wind, or wait, with utility 10. Wind probability is 0.3. A signal is "high" with probability 0.8 in wind and 0.2 in calm. What is the signal's VPI?
  1. 53.8
  2. 33.0
  3. 0.0
  4. 13.8
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

Deciding now gives MEU 40. Observation X raises expected MEU to 46. After X, observation Y adds an expected 9 more. Y alone is worth 11. What is the joint value of X and Y?
  1. 15
  2. 17
  3. 20
  4. 55
Show answerHide answer

Save this lesson to see this answer.

Stuck on your own question? Homework Help

Key Terms

73 Key Terms, each with its definition

A

Acceptance rate
An acceptance rate is the fraction of generated samples retained; in rejection sampling its expectation is the evidence probability.
Evidence with probability 0.003 retains about three of every thousand prior draws on average.
Active path
An active path has no observed non-collider and every collider is observed or has an observed descendant.
On the path Rain → Traffic ← Accident, observing Late, a child of Traffic, opens the Traffic collider.
Ancestor pruning
Ancestor pruning removes variables outside the ancestors of the query and evidence, eliminating irrelevant leaves backward.
An unobserved Umbrella leaf can be removed for the query Rain given Late.

B

Base-rate neglect
Base-rate neglect is giving a prior probability too little weight when interpreting evidence about a possible state.
A rare condition can remain unlikely after a positive result despite high test sensitivity.
Bayes' rule
Bayes' rule computes a posterior by multiplying the likelihood by the prior and dividing by the evidence probability.
When Bayes' rule is applied to a warning, the denominator adds both the true-warning and the false-warning cases.
Bayesian network
A Bayesian network represents a joint distribution using a directed acyclic graph and a local probability table at each node.
A commute network that stores ten free probabilities replaces a full joint table needing 31.
Burn-in
Burn-in is an initial portion of a sampling chain discarded to reduce the effect of the chosen starting assignment.
Early states may reflect initialization more strongly than later states after the chain has moved.

C

Certainty equivalent
A certainty equivalent is the sure amount whose utility equals the expected utility of a specified lottery.
An agent with square-root utility has a certainty equivalent of 250 for a half-chance of receiving 1,000.
Chain rule
The chain rule factorizes a joint probability into successive conditionals, each conditioned on all earlier variables in an order.
For three variables, the final term retains both preceding values unless an independence removes one.
Collider
A collider is an internal path node where both adjacent arrows point inward; observing it or a descendant opens that part of the path.
Traffic is the collider on the path Rain → Traffic ← Accident.
Common cause
A common cause is the middle node in a fork with arrows to both endpoints; observing it blocks that fork path.
Rain is the common cause on Umbrella ← Rain → Traffic.
Conditional independence
Conditional independence means that once specified variables are known, learning one further variable adds no information about another.
Fever adds nothing about cough once flu status is fixed in the flu model.
Conditional probability
A conditional probability gives the relative share of an event among the outcomes consistent with specified evidence.
In a weather-and-bus table, rain given a late bus uses the late column as its population, not all possible worlds.
Conditional probability table
A conditional probability table lists a node's value probabilities for each assignment of its parents, with each row summing to 1.
In a Traffic table with parents Rain and Accident, the row for rain without an accident assigns 0.7 to true and 0.3 to false.
Consistent estimator
A consistent estimator approaches the target probability as the number of relevant samples grows without bound under its sampling conditions.
In a commute model where the lateness probability is 0.2765, prior-sample lateness frequencies approach 0.2765.

D

d-separation
d-separation holds when every path between two variables is blocked by the evidence according to collider and non-collider rules.
On a commute path running from Umbrella through Rain to lateness, observing Rain blocks that path.
Decision network
A decision network extends a probabilistic model with controlled choices, utilities and information available when actions are chosen.
A decision network for an event connects rain and an organizer's indoor-or-outdoor choice to utility.
Decision node
A decision node represents an action the agent controls; its incoming arrows indicate information available before choosing.
A forecast arrow into the event decision lets the organizer adapt the location to the forecast.
Decision threshold
A decision threshold is a probability value where competing actions have equal expected utility and the preferred choice can switch.
For an organizer choosing between holding an event indoors or outdoors, the two actions tie when the current rain probability is 4/11.
Deterministic node
A deterministic node has a value fixed by its parent values, so its conditional probability rows contain only zeros and ones.
The rule "Late equals Traffic or Strike" fixes the output for each parent combination.
Directed acyclic graph
A directed acyclic graph has arrows between nodes but no path that follows arrow directions back to its starting node.
The path from Rain through Traffic to Late never returns to Rain along directed arrows.
Domain
A domain is the set of values a random variable can take, such as true and false for a Boolean variable.
Traffic has domain {true, false}, while Weather has domain {sun, cloud, rain}.

E

Elimination order
An elimination order specifies the sequence of hidden variables to remove and determines the intermediate scopes created during inference.
Eliminating a central hidden parent too early can join otherwise separate branches into a large factor.
Event
An event is a set of outcomes whose probability is found by adding the probabilities of all outcomes in that set.
The event "the bus is late" groups the late worlds across sun, cloud and rain.
Evidence
Evidence is an observed assignment of values that stays fixed while an inference algorithm computes the query distribution.
If Umbrella is observed true, its true-value likelihood must be retained in the calculation.
Expected utility
Expected utility is the probability-weighted average of an action's outcome utilities, calculated using the available evidence.
A large possible reward can be outweighed by its small chance and the utilities of other outcomes.
Explaining away
Explaining away occurs when, after observing a shared effect, evidence for one cause reduces belief in another possible cause.
Given heavy traffic, learning that it rains reduces the accident probability in the commute model.

F

Factor
A factor is a nonnegative table over a set of variables, used to store probability products or partial sums without requiring normalization.
Fixing Late to true in a table of Late given Traffic gives a factor over Traffic with entries 0.6 and 0.1.
Factor join
A factor join multiplies matching entries from factors and produces a table over the union of their variable scopes.
Joining an accident prior with a Traffic CPT whose parents are Rain and Accident produces a table over Rain, Accident and Traffic.

G

Gibbs sampling
Gibbs sampling builds a chain by resampling one non-evidence variable from its conditional distribution given the current other values.
Updating Rain uses Traffic, Umbrella and Accident while their current values stay fixed.

H

Hidden variable
A hidden variable is a variable whose value is neither requested as the query nor fixed as evidence in an inference problem.
Cough is hidden when finding the flu distribution with only fever observed.

I

Independence
Independence means that joint probabilities equal products of marginals for every combination of values of the variables.
Rain and bus lateness fail this test, since their joint probability, 0.12, differs from their marginal product, 0.068.
Inference by enumeration
Inference by enumeration adds the probabilities of all evidence-compatible hidden assignments and normalizes the totals for query values.
An enumerated total of 0.0925 for rain and lateness becomes a posterior only after normalization.

J

Joint distribution
A joint distribution assigns probabilities to every combination of values of its variables, with the whole table summing to 1.
In a joint table over weather and bus status, the world with rain and a late bus has probability 0.12.

L

Leak cause
A leak cause is an always-present cause in a noisy-OR model that allows an effect to occur when listed causes are inactive.
A jam can still occur without a listed accident or roadworks when a leak represents other causes.
Likelihood
A likelihood is the probability of the observed evidence under a particular proposed state or cause.
The test sensitivity of 0.9 supplies the positive-result likelihood under illness.
Likelihood weighting
Likelihood weighting fixes evidence, samples other variables and weights each assignment by the product of its evidence likelihoods.
With Late and Umbrella fixed as evidence, a sampled assignment with rain and traffic receives weight 0.54.
Local Markov property
The local Markov property makes a node conditionally independent of its non-descendants once its parents are known.
In a commute model where Traffic is Late's only parent, Rain and Umbrella give no extra information about Late once Traffic is known.
Lottery
A lottery is an uncertain prospect described by its possible outcomes and the probability attached to each one.
A 50% payment of 1,000 and a 50% payment of zero form a two-outcome lottery.

M

Marginalization
Marginalization is the process of adding over unwanted variables in a joint distribution to retain probabilities for the others.
Adding the two rainy cells of a weather-and-bus joint table, one for each bus value, gives a marginal rain probability of 0.20.
Markov blanket
A Markov blanket consists of a node's parents, children and children's other parents, screening it off from all remaining nodes.
Accident belongs to Rain's blanket because both are parents of Traffic.
Maximum expected utility
Maximum expected utility is the largest expected utility among available actions and is the value attained by an optimal choice.
For an event organizer without a forecast, choosing outdoors gives the best expected utility, 70.
MCMC
Markov chain Monte Carlo (MCMC) uses a sequence of dependent states whose long-run distribution is the probability distribution being estimated.
Gibbs sampling targets the posterior over non-evidence variables with evidence held fixed.
Mixing
Mixing describes how effectively a sampling chain moves through its target distribution instead of remaining near a limited region.
Nearly deterministic relationships can keep a Gibbs chain close to one state for many updates.
Mutual exclusivity
Mutual exclusivity means two events cannot occur together; if both have positive probability, they are dependent.
The values sun and rain are mutually exclusive weather events for one modeled observation.
Myopic information gathering
Myopic information gathering selects the best positive net-value observation one at a time without planning combinations of observations.
Two individually useless signals may be valuable together, so a greedy strategy can miss their joint benefit.

N

Naive Bayes model
A naive Bayes model uses a class prior and feature likelihoods, assuming the features are conditionally independent given the class.
A spam score multiplies its prior by the likelihoods of the observed words within spam.
Noisy-OR
A noisy-OR models an effect whose active causes fail independently, multiplying their inhibition probabilities for the no-effect chance.
Accident and roadworks inhibitions of 0.2 and 0.4 yield a combined jam probability of 0.92.
Nonadditivity of VPI
Nonadditivity of VPI means the joint value of observations generally differs from the sum of their separate values.
Forecast and weather separately total 35 in value, but observing both is worth only 21.
Nonnegativity of VPI
Nonnegativity of VPI means free information cannot reduce the best expected utility before its result is known, because it can be ignored.
A wet forecast can lower conditional MEU even though the forecast's overall VPI is positive.
Normalization
Normalization divides nonnegative scores by their positive total to turn their relative sizes into a probability distribution.
Dividing 0.08 and 0.09 by 0.17 produces the two flu probabilities given fever.

P

Parent
A parent is a node with a direct arrow into another node, whose value is used to select that child's conditional probability row.
Rain and Accident are both parents of Traffic in the commute network.
Policy
A policy assigns an action to each possible observation available at decision time, allowing the choice to respond to new information.
The event policy selects indoors after a wet forecast and outdoors after a dry one.
Polytree
A polytree is a directed acyclic graph with at most one undirected path between any two nodes, supporting efficient exact inference.
A commute graph in which Traffic has two incoming arrows is still a polytree if no two nodes are joined by more than one undirected path.
Posterior probability
A posterior probability describes belief after evidence has been incorporated by conditioning or Bayesian updating.
For an illness with prior probability 0.01, a positive test raises the illness probability to about 0.154.
Prior probability
A prior probability describes belief before the new evidence of interest is incorporated, including any background already known.
An illness prior of 0.01 describes belief before a test result is used to update it.
Prior sampling
Prior sampling generates joint assignments by sampling every variable in topological order from its parent-conditioned probability table.
A sampled rain value selects the umbrella row used later in the same assignment.
Product rule
The product rule expresses a joint probability as a conditional probability multiplied by the probability of its condition.
Multiply the rain probability by the probability of lateness under rain to get their joint probability.

Q

Query variable
A query variable is the variable whose probability distribution is requested, while evidence fixes observed values of other variables.
Rain is the query variable in a calculation of rain given observed lateness.

R

Random variable
A random variable is a function assigning a value to every outcome in the sample space, with a specified set of possible values.
In a model of weather and a bus, Weather maps each possible world to sun, cloud or rain, regardless of whether the bus is late.
Rejection sampling
Rejection sampling estimates a conditional distribution by discarding prior samples that disagree with observed evidence.
If 280 of the prior samples are late, only those 280 form the denominator when estimating a commute probability given lateness.
Risk aversion
Risk aversion values a sure amount at least as highly as a lottery with the same expected money and is represented by concave utility.
An agent with square-root utility values the utility of a lottery's mean money more than the mean of its utilities.
Risk premium
A risk premium is the difference between a lottery's expected monetary value and its certainty equivalent.
Expected money of 500 and a certainty equivalent of 250 produce a risk premium of 250.

S

Sample space
A sample space is the complete set of mutually exclusive outcomes considered by a probability model.
A sample space of weather and bus values has six worlds, one for each pair of a weather value and a bus value.
Sample weight
A sample weight measures how strongly an assignment contributes to a weighted estimate, according to its fixed-evidence likelihood.
Two assignments that both keep evidence true can carry weights of 0.54 and 0.02.
Summing out
Summing out a variable adds factor entries across all its values, retaining a separate entry for each remaining assignment.
Summing Accident out of a joined table leaves a factor over Rain and Traffic.

T

Topological order
A topological order lists the nodes of a directed acyclic graph so that every parent appears before each of its children.
When Rain and Accident are parents of Traffic, both must precede Traffic when generating a commute sample.

U

Utility function
A utility function assigns numbers to outcomes to represent preferences, with higher values assigned to preferred outcomes.
Square-root utility can favor a sure 400 over a lottery whose expected money is 500.
Utility node
A utility node assigns a utility to each combination of its parent values, including relevant actions and uncertain states.
A utility table for an event's location assigns 70 to indoors with rain and 60 to indoors without rain.

V

Value of perfect information
The value of perfect information is the expected increase in maximum expected utility from learning a variable's value before acting.
For an organizer choosing an event location, learning the forecast is worth 14 utility units before either forecast result is known.
Variable elimination
Variable elimination computes exact queries by repeatedly joining all factors containing a hidden variable and summing that variable out.
When querying Rain in a commute network, eliminating Accident before Traffic reuses a four-entry factor.

W

Weight concentration
Weight concentration occurs when a few assignments carry most of the total sample weight, limiting the information in the estimate.
Rare leaf evidence can assign tiny weights to nearly every upstream draw.
Weighted estimate
A weighted estimate divides the total sample weight supporting a query value by the total weight across all generated samples.
Two true-query samples can contribute less probability than one heavily weighted false-query sample.

About this lesson

By StudeliReport a mistake

Make your own Study Materials

Turn your notes, slides and documents into Study Guides, Practice Questions, Flashcards and 6 more tools.

Get Started