IE437 · Data-Driven Decision Making and Control — Lecture 3
Bayesian Networks
A belief about many things is a graph
Jinkyoo Park · KAIST Structure tames the joint — and once a decision hangs off the graph, every later lecture is already in the room
Bayesian NetworksLecture 3
Where we are — one unknown becomes many
Probability + statistics + graph theory.
Lecture 2 updated one unknown. A Bayesian network connects many interacting variables: represent a system, infer its hidden parts, then decide.
Source alignment: original PDF p. 3.
Lecture 3 · Bayesian Networks2 / 114
Bayesian NetworksLecture 3
Learning route — from a joint probability to a decision
Bring: Bayes' rule and marginalization from Lecture 2.
First pass
What to do
Follow the idea
Represent → infer → learn local tables → track a hidden state → choose by utility
Work without the solution
Compute a posterior, one filtering update and an expected-utility choice.
Return later
Structure search, hybrid/time-series extensions and full elimination derivations are references.
For the temperature thread: predict → calculate → reveal and check → change one condition. Complete the core calculation before reading the research extensions.
Lecture 3 · Bayesian Networks3 / 114
Act 1
The joint as a graph
Q1. Every distribution factorises somehow. A Bayesian network is a factorisation you can draw — and drawing it is what makes it cheap.
ACT 1The joint as a graphLecture 3
A joint, written out in full
Q1 Why a graph?Q2 What does it encode?Q3 How do I infer?Q4 How do I decide?
A
B
C
P(A,B,C)
0
0
0
0.08
0
0
1
0.15
0
1
0
0.05
0
1
1
0.10
1
0
0
0.14
1
0
1
0.18
1
1
0
0.19
1
1
1
0.11
Three binary variables, and what the table costs
23=8 rows — every combination A, B and C can take. The last is forced by the others, so 23−1=7 free numbers.
The table is complete: every question about A, B and C is a sum over some of its rows, and nothing is assumed.
That completeness is exactly the problem. It is useless at scale, because a flat table has no way to say that A is irrelevant to C once B is known.
A graph can say it. That is the whole content of this act.
Lecture 3 · Bayesian Networks5 / 114
ACT 1The joint as a graphLecture 3
First read the arrows — directed and undirected graphs
Original node positions and arrow directions, PDF p. 6.
An edge connects two nodes. An arrow also gives a direction. A Bayesian network uses directed edges.
Source alignment: original PDF p. 6.
Lecture 3 · Bayesian Networks6 / 114
ACT 1The joint as a graphLecture 3
A directed acyclic graph, and the words for reading one
Follow the arrows and try to return to the starting node.
A directed acyclic graph (DAG) has no directed cycle. On the left, A→B→C→A returns to A; on the right it cannot.
A DAG gives a topological order: generate each variable after its parents. Arbitrary tables on a directed cycle do not provide this guarantee.
Source alignment: original PDF p. 7.
Lecture 3 · Bayesian Networks7 / 114
ACT 1The joint as a graphLecture 3
Read one graph three ways — nodes, edges and a matrix
The same eight-node graph, edge list and adjacency matrix.
Read arrows entering x4: its parents are x1,x2,x3. Follow arrows leaving it: its children are x5,x6.
Source alignment: original PDF p. 8.
Lecture 3 · Bayesian Networks8 / 114
ACT 1The joint as a graphLecture 3
A satellite — two causes and two visible symptoms
Retain the diamond-shaped system diagram.
Battery B and solar panel S feed electrical state E; E feeds trajectory D and communication C. Read each node as a random variable.
Source alignment: original PDF p. 11, pp. 10–12.
Lecture 3 · Bayesian Networks9 / 114
ACT 1The joint as a graphLecture 3
The factorisation — one joint, written locally
A Bayesian network specifies p(x1,…,xn)=∏ip(xi∣pai) on a DAG.
Each table sits beside the node whose local distribution it specifies.
p(B,S,E,D,C)=p(B)p(S)p(E∣B,S)p(D∣E)p(C∣E).
Free parameters:1+1+4+2+2=10, compared with 25−1=31 in the full joint.
Source alignment: original PDF p. 13.
Lecture 3 · Bayesian Networks10 / 114
ACT 1The joint as a graphLecture 3
Multiply first, then sum — a two-node calculationan illustrative sensor model; each row has a clear role
Let F mean a machine fault and A mean an alarm: F→A. Use P(F)=0.1, P(A∣F)=0.8, P(A∣¬F)=0.2.
Case
Local probabilities
Joint probability
Fault and alarm
0.1×0.8
0.08
No fault and alarm
0.9×0.2
0.18
The alarm probability sums both possible causes: P(A)=0.08+0.18=0.26.
P(F∣A)=P(A)P(F,A)=0.260.08≈0.308.
Multiply along a complete case, add mutually exclusive cases, normalise after observing evidence. An alarm increases the fault probability from 10% to about 31%; it does not make a fault certain.
Lecture 3 · Bayesian Networks11 / 114
ACT 1The joint as a graphLecture 3
The collapse, in numbers
The joint's cost is 2n−1 whatever you do. With a fixed upper bound on the number of parents, each binary node needs a bounded-size table. The network then grows linearly in the number of nodes while the full joint grows exponentially. Slide n and watch the gap open; the satellite sits at n=5, where 31 becomes 10.
Lecture 3 · Bayesian Networks12 / 114
ACT 1The joint as a graphLecture 3
The wall — a joint distribution is exponentially large
For n binary variables the joint p(x1,…,xn) is a table of 2n rows, so specifying it takes
2n−1independent numbers(Mn−1 if each variable has M values)
Five binary variables need 31 numbers. Twenty need 1 048 575. Thirty need over a billion. Too many to store, far too many to estimate from data, and hopeless to sum over.
The escape is structure: a belief about many things is a graph.
Lecture 3 · Bayesian Networks13 / 114
ACT 1The joint as a graphLecture 3
Every distribution is a Bayesian network — and that is the catch
The chain rule already writes any joint as a product of conditionals:
which is a Bayesian network — on the fully connected DAG. It costs exactly 2n−1 numbers and buys nothing.
The saving is not in the factorisation. It is in the edges you leave out.
p(C∣E) rather than p(C∣E,B,S,D) is a conditional-independence claim: once the electrical state is known, the other listed variables add no information about communication loss. Observing descendants D,C can still change our belief about E, even when B,S are known. The DAG is the model, and every missing arrow is an assumption you are on the hook for. Act 2 says exactly which assumptions a given DAG makes.
Lecture 3 · Bayesian Networks14 / 114
ACT 1The joint as a graphLecture 3
Check — where the saving comes from
A Bayesian network factorises the joint as ∏ip(xi∣pa(xi)). Where does the reduction from 2n numbers actually come from?
The chain rule p(x1)p(x2∣x1)p(x3∣x1,x2)⋯ is always true and saves nothing — the last factor still conditions on everything. What buys the reduction is each missing edge, every one of which is a claimed conditional independence. A Bayesian network is therefore a statement about what does not influence what, and its compactness is only as honest as those claims.
Lecture 3 · Bayesian Networks15 / 114
Act 2
What the graph encodes
Q2. The full graph specifies conditional independences. A missing direct arrow alone does not rule out dependence through another path.
ACT 2What the graph encodesLecture 3
Conditional independence — the meaning of a missing edge
Q1 Why a graph?Q2 What does it encode?Q3 How do I infer?Q4 How do I decide?
Independence
X⊥Y⟺p(X,Y)=p(X)p(Y)
equivalently p(X∣Y)=p(X): learning Y tells you nothing about X.
Conditional independence
X⊥Y∣Z⟺p(X,Y∣Z)=p(X∣Z)p(Y∣Z)
equivalently p(X∣Y,Z)=p(X∣Z): once you know Z, learning Y tells you nothing further about X.
The DAG's basic promise is the local Markov property: a variable is independent of its non-descendants given its parents. In the satellite network, C⊥B∣E — knowing the battery failed does not move your belief about communication loss if the electrical system's state is already known. Likewise D⊥S∣E.
That single sentence is what the missing edges B→C and S→D mean. This is also why the binary conditional p(C∣E) has two free numbers; conditioning on four binary variables would require sixteen.
Lecture 3 · Bayesian Networks17 / 114
ACT 2What the graph encodesLecture 3
See why the collider is different
Blue: conditioning separates; red: conditioning can couple.
The three blue rows factor after observing z. In the red row, p(z∣x,y) still connects the two causes.
Source alignment: original PDF p. 16.
Lecture 3 · Bayesian Networks18 / 114
ACT 2What the graph encodesLecture 3
Three structures, three verdicts
Chain any two variables through a third and there are only three shapes. Whether X and Y are independent depends on the shape and on whether the middle node is observed.
structure
shape
X⊥Y with Zunobserved
X⊥YgivenZ
chain
X→Z→Y
not guaranteed
yes
fork (common cause)
X←Z→Y
not guaranteed
yes
collider (common effect)
X→Z←Y
yes
not guaranteed
For these isolated graphs, observing a chain or fork middle node blocks the path; observing a collider opens it. An open path permits dependence:
This structural test guarantees independence for every compatible probability table. An open path gives no such guarantee; special tables can still make the variables independent.
Lecture 3 · Bayesian Networks19 / 114
ACT 2What the graph encodesLecture 3
Marginalize or condition — watch the connection change
Left: common cause; right: common effect.
Crossed-out z: sum it out. Shaded z: observe it. A remaining line permits dependence; disconnected nodes are independent.
Source alignment: original PDF p. 17.
Lecture 3 · Bayesian Networks20 / 114
ACT 2What the graph encodesLecture 3
Explaining away — the collider, in wordsnothing changed in the world; something changed in what you know
The electrical failure is observed; the competing causes are highlighted.
Before:B and S are independent. Observe E: the electrical system failed. Then learn B failed: in a competing-causes model, less evidence is needed for S to explain E.
The collider permits explaining away. Its probability table determines the sign and size of the dependence.
Source alignment: original PDF p. 24.
Lecture 3 · Bayesian Networks21 / 114
ACT 2What the graph encodesLecture 3
Wet grass — the graph and its probability tables
Graph above, local probability tables below; the table label is corrected to p(T∣R,S).
First specify the model. Next ask whether wet grass supports the sprinkler, the rain, or both.
Source alignment: original PDF p. 19.
Lecture 3 · Bayesian Networks22 / 114
ACT 2What the graph encodesLecture 3
Wet grass — explaining away, with numbersExample 3.1
The model
S sprinkler on · R raining · T Tracey's grass wet · J Jack's grass wet
S→T←R→J
p(T,J,R,S)=p(T∣R,S)p(J∣R)p(R)p(S)
p(S=1)=0.1, p(R=1)=0.2; the grass is certainly wet if it rained, wet with probability 0.9 if only the sprinkler ran, and dry otherwise; p(J=1∣R=1)=1, p(J=1∣R=0)=0.2.
The two queries
p(S=1)=0.100
p(S=1∣T=1)=0.2720.092=0.338
p(S=1∣T=1,J=1)=0.21440.0344=0.160
Tracey's wet grass more than triples the suspicion of the sprinkler. Then Jack's wet grass — evidence for the rival cause — halves it again.
Note that J is not on the collider path at all; it is a child of R. It moves the answer only because it moves R, and R competes with S to explain T. Note also that p(S=1∣J=1)=0.100 exactly — with T unobserved, Jack's lawn says nothing whatever about Tracey's sprinkler.
Lecture 3 · Bayesian Networks23 / 114
ACT 2What the graph encodesLecture 3
Evidence, entered by hand
Click a node to observe it. The two blue edges are the collider path S→T←R; they light when observing T opens it. The readout is the exact posterior over the sprinkler, computed by enumerating all sixteen states. Observe T alone and the collider opens; add J and the rain explains the sprinkler away; observe R directly and the sprinkler snaps back to its prior, because with the rain known, wet grass says nothing.
Lecture 3 · Bayesian Networks24 / 114
ACT 2What the graph encodesLecture 3
Burglar alarm — two competing explanations
The first prior label is corrected to P(B=1)=0.01.
The alarm has two parents. A radio report is evidence about earthquake E; after hearing the alarm, it can change our belief about burglary B.
Source alignment: original PDF p. 21.
Lecture 3 · Bayesian Networks25 / 114
ACT 2What the graph encodesLecture 3
The burglar alarm — the same move, sharperExample 3.2
The model
B burgled · E earthquake · A alarm sounds · R radio reports a quake
B→A←E→R
p(B=1)=0.01, p(E=1)=10−6. The alarm is near-certain given either cause and almost never fires without one; the radio reports a quake exactly when there is one.
The collapse
p(B=1)=0.01
p(B=1∣A=1)=0.99
p(B=1∣A=1,R=1)=0.01
The alarm makes a burglary near-certain. One radio bulletin — which says nothing about burglars — sends it straight back to the prior.
R is not connected to B by any edge, and the two are marginally independent. They become strongly dependent the instant the alarm is heard — the same collider move as the wet grass, on a graph built to make it matter.
Lecture 3 · Bayesian Networks26 / 114
ACT 2What the graph encodesLecture 3
What the missing edges buy
Storage2n−1 numbers collapse to a sum of small local tables
Learningfar fewer parameters, so far less data to estimate them from
Reasoningindependence lets sums factor — which is the whole of Act 3
All three are the same fact read three ways: a missing edge is a conditional independence, and the chain, fork and collider rules read every one of them off the graph.
Two cautions. An open path permits dependence; it does not force it, and special parameter values can cancel. And an arrow encodes a factorisation, not a causal intervention, unless a causal reading is explicitly assumed.
Lecture 3 · Bayesian Networks27 / 114
ACT 2What the graph encodesLecture 3
Check — the collider
Two independent causes point at one effect: X→Z←Y. What is the relationship between X and Y?
This is the collider, and it runs opposite to the chain and the fork. Learning the alarm went off makes burglary and earthquake compete to explain it, so hearing that there was an earthquake lowers your belief in a burglary — they became dependent the moment you conditioned on their shared effect. Explaining away is why a collider behaves opposite to a chain or a fork, and it is a standard way to introduce a correlation that is not there.
Lecture 3 · Bayesian Networks28 / 114
Act 3
Reasoning with the network
Q3. A model you cannot query is decoration. Inference is where the factorisation earns its keep — and where it still, sometimes, fails.
This is correct, and it is a disaster. The number of terms is the number of joint assignments to the hidden variables — exponential in how many there are. The curse the factorisation was supposed to have removed comes back the moment we sum.
Storing the joint cheaply is not the same as summing over it cheaply.
Lecture 3 · Bayesian Networks31 / 114
ACT 3Reasoning with the networkLecture 3
A factor covers the variables in one local table
Each outline groups the variables of one factor.
The large outline covers E,B,S: it is p(E∣B,S). Eliminating E combines every factor that mentions E.
Source alignment: original PDF p. 27.
Lecture 3 · Bayesian Networks32 / 114
ACT 3Reasoning with the networkLecture 3
Variable elimination — push each sum past what it cannot touch
A sum can slide past any factor that does not mention its variable. Do that twice:
P(b1∣d1,c1)∝s∑e∑P(b1)P(s)P(e∣b1,s)P(d1∣e)P(c1∣e)=P(b1)s∑e∑P(s)P(e∣b1,s)P(d1∣e)P(c1∣e)=P(b1)s∑P(s)e∑P(e∣b1,s)P(d1∣e)P(c1∣e)P(b1) has no s and no eP(s) has no e
The value has not changed. What has changed is how often each product is formed: the inner sum is a function of s alone once b1 is fixed, so it is computed once per value of s — not once per pair (s,e).
Every rearrangement is a choice of which variable to sum out first. Here e goes first, then s; the other order is just as legal, and two slides on it becomes clear why that choice is the whole game.
Source alignment: original PDF p. 26. The source pushes the sums the other way, with
∑s innermost; the deck sums e first so that this slide, the factor slide and
the T8 definition all use the same elimination order.
Lecture 3 · Bayesian Networks33 / 114
ACT 3Reasoning with the networkLecture 3
The same thing as tables — eliminate E, then S
Write each conditional distribution as a factor, a table over the variables it mentions, and run the rearrangement as three table operations.
startfix the evidenceeliminate Eeliminate ST1(B)T2(S)T3(E,B,S)T4(D,E)T5(C,E)T1(B)T2(S)T3(E,B,S)T6(E)T7(E)T1(B)T2(S)T8(B,S)T1(B)T9(B)keep only the d1 row of T4, the c1 row of T5T8(B,S)=∑eT3(e,B,S)T6(e)T7(e)T9(B)=∑sT2(s)T8(B,s)
Each elimination is the same move: multiply every factor that mentions the variable, then sum it out, leaving a smaller table. Two factors remain and neither mentions a hidden variable, so normalise:
P(b∣d1,c1)=∑b′T1(b′)T9(b′)T1(b)T9(b).
Source alignment: original PDF p. 27. The numbering is the source's: T6,T7 are the
evidence-sliced versions of T4,T5, which is why the eliminations produce T8 and T9.
Lecture 3 · Bayesian Networks34 / 114
ACT 3Reasoning with the networkLecture 3
The cost is the largest table you build — and the order decides it
Each elimination first builds the product of the factors that mention the variable, and that product is a table over their union of variables:
Step
Factors multiplied
Table built
Entries
eliminate E
T3(E,B,S)⋅T6(E)⋅T7(E)
over (E,B,S)
23=8
eliminate S
T2(S)⋅T8(B,S)
over (B,S)
22=4
The largest table was 8 entries — the size of P(E∣B,S) itself. Nothing bigger than a table we already had was ever built. Brute enumeration instead forms one term per assignment of the hidden variables, and that count doubles with every hidden variable added.
The largest intermediate table depends on the elimination order, and finding the best order is itself NP-hard. So the ordering is a heuristic: often linear, sometimes still exponential — the sum has not been made cheap, it has been made cheap when the graph allows it.
Source alignment: original PDF p. 27, last two lines — promoted from a footnote, since it
is the thesis of Act 3. The next slide's widget shows the two counts at twenty variables.
Lecture 3 · Bayesian Networks35 / 114
ACT 3Reasoning with the networkLecture 3
What the ordering is worth
Both columns compute the identical number. On the left, enumeration: one term per assignment of the hidden variables, so the count doubles with every variable added. On the right, elimination: each hidden variable is summed out once into a small table, so the count grows by a constant. At twenty variables it is 262 144 terms in one sum against 146 multiplications in total — and both answers agree to the last digit.
Lecture 3 · Bayesian Networks36 / 114
ACT 3Reasoning with the networkLecture 3
Generate one sample — 1/5 · Draw the battery
Sample each variable once its parents are available.
Draw B from p(B). This sample starts with B=1.
Source alignment: original PDF p. 28.
Lecture 3 · Bayesian Networks37 / 114
ACT 3Reasoning with the networkLecture 3
Generate one sample — 2/5 · Draw the solar panel
Sample each variable once its parents are available.
Draw S from p(S). The two root nodes have no parents.
Source alignment: original PDF p. 29.
Lecture 3 · Bayesian Networks38 / 114
ACT 3Reasoning with the networkLecture 3
Generate one sample — 3/5 · Draw the electrical state
Sample each variable once its parents are available.
Now both parents are available: draw E from p(E∣B=1,S=1).
Source alignment: original PDF p. 30.
Lecture 3 · Bayesian Networks39 / 114
ACT 3Reasoning with the networkLecture 3
Generate one sample — 4/5 · Draw the trajectory
Sample each variable once its parents are available.
Draw D from p(D∣E=1). A sampled outcome can be zero even when its parent is one.
Source alignment: original PDF p. 31.
Lecture 3 · Bayesian Networks40 / 114
ACT 3Reasoning with the networkLecture 3
Generate one sample — 5/5 · Draw communication
Sample each variable once its parents are available.
Draw C from p(C∣E=1). The row is now one complete sample from the joint.
Source alignment: original PDF p. 32.
Lecture 3 · Bayesian Networks41 / 114
ACT 3Reasoning with the networkLecture 3
Reject rows that disagree with the evidence
Three of the nine displayed rows match D=C=1.
Among the three matching rows, one has B=1: the sample estimate is 1/3. This is an estimate, not an exact posterior.
Source alignment: original PDF p. 34, pp. 33–34.
Lecture 3 · Bayesian Networks42 / 114
ACT 3Reasoning with the networkLecture 3
Weight the evidence instead of rejecting a rowevery row is kept — but each one pays for the evidence it was handed
The red D,C columns were never sampled; the last column is what each row pays.
Rejection threw away six rows in nine. The waste is in sampling D and C at all, only to check them against values we already know. So do not sample them — write D=1, C=1 straight into every row.
That is cheating, and the weight is the price. A row whose sampled E would have produced D=C=1 on its own has earned them; a row whose E makes them improbable was handed them. So each row counts in proportion to how plausibly it could have produced the evidence:
w=how likely this row’s E makes D=1P(D=1∣E)⋅and C=1P(C=1∣E)
Nothing is discarded: every row votes, and its vote is scaled by its weight — full strength if it earned its evidence, faintly if it was forced.
Source alignment: original PDF p. 35. Only E appears in the weight because, by the
factorisation of Act 1, E is the only parent D or C has.
Lecture 3 · Bayesian Networks43 / 114
ACT 3Reasoning with the networkLecture 3
How different a 0.72 and a 0.02 really aretwo illustrative conditionals, the same evidence, very different weight
Give E→D and E→C illustrative tables: P(D=1∣E=1)=0.9, P(C=1∣E=1)=0.8, and P(D=1∣E=0)=0.1, P(C=1∣E=0)=0.2.
w(E=1)=0.9×0.8=0.72w(E=0)=0.1×0.2=0.02
A row with E=1 explains D=C=1thirty-six times more plausibly than a row with E=0. Both rows are kept — one just earns its evidence, and the other barely does.
Illustrative numbers, chosen to make the contrast obvious. The source states the weight formula on p. 36 without evaluating it; the next slide does.
Lecture 3 · Bayesian Networks44 / 114
ACT 3Reasoning with the networkLecture 3
Three rows, weighed instead of countedthe same three surviving rows from p. 36, now scored instead of tallied
B
S
E
weight w=P(D=1∣E)P(C=1∣E)
1
0
1
0.9×0.8=0.72
0
1
1
0.9×0.8=0.72
0
1
0
0.1×0.2=0.02
P(B=1∣D=C=1)=0.72+0.72+0.020.72=1.460.72≈0.493.
Not 1/3. The earlier rejection-sampling count gave every surviving row one vote regardless of how well it explained the evidence. The row with E=0 survived too — but it barely earned its place, and its vote counts accordingly.
The three rows and the weight formula are original PDF p. 36; the illustrative P(D∣E), P(C∣E) are from the previous slide.
Lecture 3 · Bayesian Networks45 / 114
ACT 3Reasoning with the networkLecture 3
Why B, S and E carry no weight of their ownthey already paid — by how often they were drawn
Sample B,S,E honestly from P(B),P(S),P(E∣B,S) and their probabilities are already built into how many rows carry each value. With P(B=1)=0.1, roughly one row in ten already has B=1 — not because a weight said so, but because that is how often the sampler drew it.
D and C get no such chance: they are never drawn, only decreed to be 1 in every row. The only way their probability can still be counted is to pay it afterwards, as a weight. Sample a variable and it counts by frequency; clamp it and it counts by weight — never both. That is why P(B), P(S) and P(E∣B,S) never reappear inside w.
Likelihood weighting in one sentence: whatever you did not sample, you must pay for.
Lecture 3 · Bayesian Networks46 / 114
ACT 3Reasoning with the networkLecture 3
Why the weighted vote is the right answer
Two facts, and the method follows from their product. A row (b,s,e) is drawn with the prior probability of its unclamped part, and it is then weighted by the evidence's probability given that part:
how often the row is drawnP(b)P(s)P(e∣b,s)×its weightP(D=1∣e)P(C=1∣e)=P(b,s,e,D=1,C=1).
Drawn-frequency times weight is the joint probability of the row together with the evidence — the very quantity rejection sampling estimates by keeping only matching rows. So weighted rows carry the same information as surviving rows, and none had to be thrown away. Averaging the weights over rows with B=1, against the weights over all rows, cancels the constant P(D=1,C=1):
Rejection and weighting estimate the same posterior. The difference is only that weighting spends every sample — and when the evidence is rare, that is the difference between an answer and none.
Checked numerically on the spacecraft network with illustrative tables: the identity holds
row by row, and with 200 000 draws rejection kept 21 463 rows (89% discarded) while
weighting used all of them; both landed on the exact posterior to three decimals. The
next slide is the case weighting still handles badly — a rare cause.
Lecture 3 · Bayesian Networks47 / 114
ACT 3Reasoning with the networkLecture 3
Rare causes — why weighting can still struggleCompare an exact posterior with rare prior draws
A rare cause C can have posterior probability 0.5 after observing D=1.
But likelihood weighting still proposes C=1 with probability 0.001. In 1,000 draws, the probability of missing it entirely is 0.9991000≈0.368.
A run with no C=1 sample estimates zero. That is a sampling failure; the model's conditional probability has not become zero.
Source alignment: original PDF p. 36.
Lecture 3 · Bayesian Networks48 / 114
ACT 3Reasoning with the networkLecture 3
When exact inference is hopeless — sample
Direct sampling, with rejection
Walk the DAG in topological order, drawing each variable from p(xi∣pai); keep only the runs that happen to match the evidence, and count.
Nine samples of the satellite network, three of which show d1,c1, one of those with b1:
P^(b1∣d1,c1)=1/3
The flaw. If the evidence is unlikely, almost every sample is thrown away.
Likelihood weighting, and its flaw
Do not reject. Clamp each evidence variable to its observed value and carry a weight w←w×P(xi∣pai) for the clamping.
A different failure mode. Take C→D with p(c1)=0.001, p(d1∣c1)=0.999, p(d1∣c0)=0.001. The exact posterior is p(c1∣d1)=0.5. But C is still drawn from its prior. The chance of seeing no c1 in 1,000 draws is 0.9991000≈0.368. Such a run reports 0 for an answer that is a half.
The cure is to stop sampling variables independently: Gibbs sampling sweeps through the variables, redrawing each from its conditional given the current value of all the others, and, under suitable irreducibility and mixing conditions, approaches the posterior. A finite burn-in does not guarantee exact posterior samples. Approximate inference is not a shortcut; it is a second set of failure modes, traded for the first.
Lecture 3 · Bayesian Networks49 / 114
ACT 3Reasoning with the networkLecture 3
Check — cheap to store, cheap to use?
A network is sparse: every node has at most three parents, so the whole model is a few hundred numbers. What does that guarantee about the cost of exact inference?
Storing the joint cheaply and summing over it cheaply are different problems. Exact inference is NP-hard in general, and its real cost is governed by how large the intermediate factors grow as variables are eliminated — the treewidth — which a sparse-looking graph can still make enormous. This is why the chapter has to talk about elimination order at all.
Lecture 3 · Bayesian Networks50 / 114
ACT 3Reasoning with the networkLecture 3
Naive Bayes — classification is posterior inferenceA familiar use of the same graph
One class node, many observed features.
Given class C, the features are conditionally independent:
P(C=c∣o1:n)∝P(C=c)i∏P(oi∣C=c).
For an illustrative two-class, two-feature problem:
Thus P(A∣o1,o2)=0.16/0.22≈0.727. Choose A under equal misclassification costs.
“Naive” describes the conditional-independence assumption. It does not mean that the observed features must be marginally independent.
Source alignment: original PDF p. 43.
Lecture 3 · Bayesian Networks51 / 114
LEARNING
Learning a model from data
Inference assumes the local tables are given. Learning estimates those tables from observations.
LEARNINGLearning a model from dataLecture 3
Learning the tables — reuse Lecture 2 locallyParameter learning, with the graph fixed
For complete discrete data, count each node separately for each configuration of its parents:
p^(Xi=k∣pai=j)=∑k′Nijk′Nijk.
In the illustrative fault model, suppose 8 of 10 faulty machines and 18 of 90 healthy machines trigger the alarm.
Conditional row
MLE
Posterior mean with a separate Beta(1,1) prior
P(A=1∣F=1)
8/10=0.8
9/12=0.75
P(A=1∣F=0)
18/90=0.2
19/92≈0.207
A Bayesian network gives many small estimation problems. Missing or latent variables require inference as part of learning; counting observed rows alone is then insufficient.
Source alignment: original PDF p. 44.
Lecture 3 · Bayesian Networks53 / 114
FILTERING
Tracking a hidden state through time
Use the transition model to predict, then use a new observation to update.
FILTERINGTracking a hidden state through timeLecture 3
A dynamic Bayesian network — repeat the same local structure
Input, hidden state and observation stay in three aligned rows.
The horizontal arrows carry the state forward. Vertical and curved arrows describe what happens within one time step.
Source alignment: original PDF p. 47.
Lecture 3 · Bayesian Networks55 / 114
FILTERINGTracking a hidden state through timeLecture 3
The same graph, unrolled through time
Nothing so far said the variables were simultaneous. Index them by time and the identical machinery becomes a model of a system evolving.
the future is conditionally independent of the past given the present, St+1⊥S1:t−1∣St. Which is a conditional independence — a chain structure, read off a graph.
2 · The stationarity assumption
P(St+1=s′∣St=s)=P(S′=s′∣S=s)∀t
one transition table, shared by every time step, instead of T of them.
Lecture 7 will open by assuming both of these. Markov structure is a conditional-independence assumption. Time homogeneity is a separate parameter-sharing assumption: the transition table does not change with time.
Lecture 3 · Bayesian Networks56 / 114
FILTERINGTracking a hidden state through timeLecture 3
Markov order — how far back do the arrows reach?
Without an assumption, a state may depend on the whole past.First-order and second-order chains, side by side.
A first-order model keeps only the previous state. A second-order model keeps the previous two.
Source alignment: original PDF p. 49, p. 50.
Lecture 3 · Bayesian Networks57 / 114
FILTERINGTracking a hidden state through timeLecture 3
Fit a transition matrix — count where each state goesAme count-and-normalise rule
Use the source convention Mij=P(St+1=i∣St=j): column j is the distribution of the next state given the current state.
Five departures from state 1; three go to state 3, giving θ^3∣1=3/5.
For the illustrative observed sequence A,A,B,A,B,B, the four transition counts are NAA=1, NBA=2, NAB=1, NBB=1.
M^=[1/32/31/21/2],pt+1=M^pt.
Starting at A gives pt=[1,0]⊤, so the next-state probabilities are [1/3,2/3]⊤. Every column sums to one.
This is model learning from a trajectory. Predicting with pt+1=Mpt is a different operation, performed after the matrix is specified or estimated.
Source alignment: original PDF p. 53.
Lecture 3 · Bayesian Networks58 / 114
FILTERINGTracking a hidden state through timeLecture 3
Predict a marginal — collect probability from every predecessorOne destination receives mass from several possible previous states
Each blue arrow contributes transition probability times previous-state probability.
Add all routes into state i. Repeating this calculation evolves the marginal; a stationary distribution is one that the update leaves unchanged.
Source alignment: original PDF p. 52.
Lecture 3 · Bayesian Networks59 / 114
FILTERINGTracking a hidden state through timeLecture 3
A stationary model need not start in a stationary distributionEparate two uses of “stationary”
Time-homogeneous transitions: the same matrix M is used at each step. Stationary distribution: a probability vector p∞ satisfying Mp∞=p∞.
For a separate illustrative two-state model,
M=[0.90.10.20.8],p∞=[2/31/3].
From p0=[1,0]⊤, the first two distributions are p1=[0.9,0.1]⊤ and p2=[0.83,0.17]⊤: the marginal distribution changes even though M stays fixed.
For a finite irreducible, aperiodic chain, the distribution converges to its unique stationary distribution. A general Markov chain need not have that convergence property.
Source alignment: original PDF p. 52.
Lecture 3 · Bayesian Networks60 / 114
FILTERINGTracking a hidden state through timeLecture 3
State transitions — a graph of possible next states
These four nodes are state values, not four time steps.
From X2, move to X3 with probability 0.4 or X4 with probability 0.6. Outgoing probabilities sum to one.
Source alignment: original PDF p. 55.
Lecture 3 · Bayesian Networks61 / 114
FILTERINGTracking a hidden state through timeLecture 3
Hidden Markov models — name the question before computingAme hidden states, different information sets
Blue transitions, red emissions and grey observed nodes.
Question
Target
What the answer uses
Filtering
p(xt∣y1:t)
observations available now
Prediction
p(xt+h∣y1:t)
current belief, propagated into the future
Smoothing
p(xt∣y1:T), t<T
later observations to revise the past
Sequence likelihood / best hidden path
p(y1:T) / argmaxx1:Tp(x1:T∣y1:T)
model comparison / Viterbi decoding
Source alignment: original PDF pp. 54–61, p. 54.
Lecture 3 · Bayesian Networks62 / 114
FILTERINGTracking a hidden state through timeLecture 3
Filtering — locate the present
p(xt∣y1:t) · original observation shading and target highlights.
The orange node is the current target. Use the grey observations up to now; the future observation is still unknown.
Source alignment: original PDF p. 56.
Lecture 3 · Bayesian Networks63 / 114
FILTERINGTracking a hidden state through timeLecture 3
Prediction — look beyond the observations
p(xt∣y1:s),t>s · original observation shading and target highlights.
The observations stop at s. Push the current belief forward through transitions to the orange future node.
Source alignment: original PDF p. 57.
Lecture 3 · Bayesian Networks64 / 114
FILTERINGTracking a hidden state through timeLecture 3
Smoothing — use later evidence to revise the past
p(xt∣y1:u),t<u · original observation shading and target highlights.
The target stays at t, but grey observations extend to u. Later measurements can change what we believe happened earlier.
Source alignment: original PDF p. 58.
Lecture 3 · Bayesian Networks65 / 114
FILTERINGTracking a hidden state through timeLecture 3
Decoding — choose a whole hidden path
argmaxx1:up(x1:u∣y1:u) · original observation shading and target highlights.
All hidden nodes are targets together. Find the most probable complete path; separate per-time guesses need not form that path.
Source alignment: original PDF p. 60.
Lecture 3 · Bayesian Networks66 / 114
FILTERINGTracking a hidden state through timeLecture 3
Filtering — Bayes' rule, once per time step
Hide the state and observe an emission — Xt→Yt over a chain Xt−1→Xt — and you have a hidden Markov model. The standard query is filtering, the belief about now given everything seen so far:
Read it as Lecture 2's loop, run once per tick: yesterday's posterior is pushed through the dynamics to become today's prior; today's measurement is the likelihood; the product is today's posterior. Make the chain linear and the noise Gaussian and every term stays Gaussian — the recursion then carries only a mean and a covariance, and it has a name: the Kalman filter.
Lecture 3 · Bayesian Networks67 / 114
FILTERINGTracking a hidden state through timeLecture 3
One filtering step — predict, observe, normalisea two-state machine, healthy or faulty
Yesterday's posterior fault probability is 0.2. A fault persists with probability 0.8; a healthy machine develops a fault with probability 0.1.
Predict today's state:
P(Ft)=0.8(0.2)+0.1(0.8)=0.24.
Now an alarm occurs, with P(At∣Ft)=0.9 and P(At∣¬Ft)=0.1.
Correct using the observation:
P(Ft∣At)=0.9(0.24)+0.1(0.76)0.9(0.24)≈0.740.
The transition changes 0.20 to 0.24; the measurement changes 0.24 to 0.74. The corrected belief becomes the starting belief at the next time step.
Lecture 3 · Bayesian Networks68 / 114
FILTERINGTracking a hidden state through timeLecture 3
Temperature thread — infer a hidden heater modeshared teaching example · predict before revealing the calculation
In a two-mode variant, the heater is good (G) or weak (W). Initially P(G)=0.6. Next-step probabilities are P(G′∣G)=0.9 and P(G′∣W)=0.3. A warm reading has likelihood 0.8 under G′ and 0.2 under W′.
Predict: First predict the next mode without the reading. Then decide whether a warm reading should raise or lower its good-mode probability.
Calculate and check.P(G′)=0.9(0.6)+0.3(0.4)=0.66. After a warm reading,
Prediction uses the transition table; updating uses the observation likelihood. The two tables have different jobs.
Lecture 3 · Bayesian Networks69 / 114
FILTERINGTracking a hidden state through timeLecture 3
Try it — the next reading is coolwork independently · reveal only after writing an answer
Keep the same predicted probabilities (0.66, 0.34). Instead observe “cool,” the complement of “warm.” Its likelihoods are therefore 0.2 under G′ and 0.8 under W′. Calculate the new posterior.
Check your answer.P(G′∣cool)=0.132/(0.132+0.272)=33/101≈0.327. Do not start from the posterior of the warm-reading example; these are alternative observations.
When changing a condition, identify exactly which factors change. Do not reuse evidence from a different scenario.
Lecture 3 · Bayesian Networks70 / 114
FILTERINGTracking a hidden state through timeLecture 3
Add an input — the original IOHMM
At affects both the transition and the observation.
This is an input-output HMM. Choosing inputs becomes a decision problem only after specifying utilities and the information available when acting.
Source alignment: original PDF p. 62.
Lecture 3 · Bayesian Networks71 / 114
FILTERINGTracking a hidden state through timeLecture 3
A continuous hidden state — the same two-row picture
The source writes the emission matrix as Bt; the next slide uses C.
The graph still separates transitions and measurements. Linear equations and Gaussian noise let us carry a mean and covariance instead of a probability table.
Source alignment: original PDF p. 71.
Lecture 3 · Bayesian Networks72 / 114
FILTERINGTracking a hidden state through timeLecture 3
Kalman filtering — carry the mean and covariance forwardOurce names the mean f and covariance F
The old Gaussian belief becomes a new Gaussian belief after prediction and measurement correction.
The update carries two objects: where the state is likely to be, and how uncertain that estimate remains. The next slide writes these quantities as mt,Pt.
The whole posterior changes. Linear Gaussian assumptions let us represent that distribution using only its mean and covariance.
Source alignment: original PDF p. 73.
Lecture 3 · Bayesian Networks73 / 114
FILTERINGTracking a hidden state through timeLecture 3
Linear Gaussian state space — the Kalman version of the same updateTransition and observation are different models
With a Gaussian initial belief and independent Gaussian noises, the posterior remains Gaussian. Track its mean and covariance instead of a table.
Stage
Calculation
Predict state
mt−=Amt−1, Pt−=APt−1A⊤+Q
Weight the measurement
Kt=Pt−C⊤(CPt−C⊤+R)−1
Correct belief
mt=mt−+Kt(yt−Cmt−), Pt=(I−KtC)Pt−
A scalar example with m−=10, P−=4, C=1, R=1, and y=12 gives K=0.8, m=11.6 and P=0.8.
The Kalman filter is predict → observe → update, just like the discrete fault example. Gaussian conditioning makes those steps closed form.
Source alignment: original PDF pp. 71–73.
Lecture 3 · Bayesian Networks74 / 114
Act 4
From belief to decision
Q4. Everything so far describes the world. Add two node types and the graph starts choosing.
ACT 4From belief to decisionLecture 3
Bayesian network + decision + utility
Circle: chance. Square: decision. Diamond: utility. Dashed blue: information known before choosing.
Read the dashed arrow first: the result of test O1 is known before treatment T is chosen.
Source alignment: original PDF pp. 75 and 83.
Lecture 3 · Bayesian Networks76 / 114
ACT 4From belief to decisionLecture 3
Utility — a number for comparing outcomes
Probabilities describe how likely outcomes are. Utilities describe how desirable those outcomes are to the decision maker.
A certain outcome
Assign a utility U(s) to outcome s. Higher is preferred; the units can be profit, comfort or a stated combination of objectives.
An uncertain outcome
Under the expected-utility model, an action producing outcomes with probabilities pi is valued by
EU(a)=i∑piU(si).
Average utilities under belief, then take the best action. That is the entire operation a decision node performs — and, run over many stages, it is the Bellman equation of Lecture 7.
Utility need not equal money. A concave utility of money represents risk aversion; the same expected-utility calculation still applies.
Lecture 3 · Bayesian Networks77 / 114
ACT 4From belief to decisionLecture 3
Utility curves — the same money can have different value
Compare the two utility shapes on the nonnegative money range.
On the nonnegative money range: blue bends downward (risk averse); red bends upward (risk seeking). Compare expected utility, not just expected money.
Source alignment: original PDF p. 80.
Lecture 3 · Bayesian Networks78 / 114
ACT 4From belief to decisionLecture 3
Utility is not necessarily money — the original lottery exampleProbabilities describe beliefs; utilities describe preferences
Compare A: receive 1 dollar for sure with B: receive 100 dollars with probability 0.01, otherwise 0. Both have expected money 1 dollar.
Utility of money m≥0
E[U(A)]
E[U(B)]
Preferred
U(m)=m
1
0.01(10)=0.1
A: risk averse
U(m)=m
1
0.01(100)=1
indifferent: risk neutral
U(m)=m2
1
0.01(10000)=100
B: risk seeking
Same money on average, three different decisions — the shape of U is doing all the work.
Choose by E[U(M)], which need not equal U(E[M]). The utility function is part of the model, and it has to be stated before two decisions can be compared.
Source alignment: original PDF pp. 77–80.
Lecture 3 · Bayesian Networks79 / 114
ACT 4From belief to decisionLecture 3
Utility factorisation — one large function or several small ones
One diamond with many parents versus separate utility diamonds.
Additivity is an assumption about preferences. It does not say the random variables are independent.
Source alignment: original PDF p. 81.
Lecture 3 · Bayesian Networks80 / 114
ACT 4From belief to decisionLecture 3
Several consequences — when can utilities be added?Collision avoidance
The original example distinguishes horizontal closeness H, vertical closeness V, and whether an alarm is raised A.
U(h,v,a)=Useparation(h,v)+Ualarm(a).
The first term represents the consequence of unsafe separation; the second can represent alarm cost. This additive preference assumption is separate from any independence assumption about the random variables.
Representation for n binary variables
Entries to specify before accounting for utility scaling
Arbitrary joint utility U(x1,…,xn)
2n
Additive utility ∑iUi(xi)
2n
Probability factorisation makes beliefs manageable. Utility factorisation can make preferences manageable. Both gain simplicity by making explicit modelling assumptions.
Source alignment: original PDF pp. 81–82.
Lecture 3 · Bayesian Networks81 / 114
ACT 4From belief to decisionLecture 3
Collision avoidance — safety and alarm cost in one picture
Joint alarm/collision utility on the left; additive components on the right.
Unsafe horizontal and vertical separation contribute U1(h,v). Raising an alarm contributes U2(a). Add the two only if that preference model is intended.
Source alignment: original PDF p. 82.
Lecture 3 · Bayesian Networks82 / 114
ACT 4From belief to decisionLecture 3
Maximum expected utility
For action a after observation o, combine the belief model with the value of each outcome:
Green supplies the probability; red supplies the utility.
a∗=aargmaxEU(a∣o).
The Bayesian network supplies probabilities. The utility function supplies values. Average outcomes, then choose the best action.
Source alignment: original PDF p. 79.
Lecture 3 · Bayesian Networks83 / 114
ACT 4From belief to decisionLecture 3
Read the treatment diagram — compare two actionsthe original utility table, now used for a decision
Let p=P(D=1∣O1) be the disease probability after reading the test. The graph supplies p; the utility table supplies the consequences.
Choose
Healthy: D=0
Diseased: D=1
Expected utility
No treatment
0
−10
−10p
Treatment
−1
−1
−1
Treat when −1>−10p, or p>0.1; at p=0.1 the actions tie. These are the illustrative utilities specified in the model.
Lecture 3 · Bayesian Networks84 / 114
ACT 4From belief to decisionLecture 3
The PhD decision — follow cost and benefit through the graph
Education changes both study cost and the income distribution.
Choose education E first. Average over prize P and income I, then add study cost UC and income benefit UB.
Source alignment: original PDF p. 91, pp. 90–91.
Lecture 3 · Bayesian Networks85 / 114
ACT 4From belief to decisionLecture 3
Should I do a PhD?Example 3.4 · a decision network with real numbers
The network
Edo PhD / no PhD is the decision; Pwin the prize? and Iincome: low / average / high are chance; UC (cost of study) and UB (benefit of income) are utility.
E→P,{E,P}→I,E→UC,I→UB
UC(do PhD)=−50000, UC(no PhD)=0; UB=100000/200000/500000 for low / average / high income; p(prize∣PhD)=0.001 against 10−7 without.
The computation
U(E)=I,P∑p(I∣E,P)p(P∣E)[UC(E)+UB(I)]
U(do PhD)=260174
U(no PhD)=240000
The doctorate wins by about 20 000 — and almost none of that comes from the prize. It comes from the income table: a PhD shifts the chance of high income from 0.2 to 0.4, which is worth more than the 50 000 it costs.
Lecture 3 · Bayesian Networks86 / 114
ACT 4From belief to decisionLecture 3
Pick a decision, watch the utility
The same network, live. Choose an action and the expected utility is computed by exactly the machinery of Acts 1–3: the network gives p(I,P∣E), the utility nodes give the value, the sum gives EU. Then switch on the second decision and watch the recommendation reverse.
Lecture 3 · Bayesian Networks87 / 114
ACT 4From belief to decisionLecture 3
A later start-up decision — the information arrow matters
The dashed edge says the prize is known before the start-up decision.
Read the order E≺P≺S≺I. The income parents also change to S,P, so this is a different income model.
Source alignment: original PDF p. 93, pp. 92–93.
Lecture 3 · Bayesian Networks88 / 114
ACT 4From belief to decisionLecture 3
Add one option, and the answer flipsExample 3.5 · PhD and start-ups
What changes
A second decision Sfound a start-up? is added, with US(yes)=−200000, and an information edge P⇢S — the prize is known before the start-up is founded. Crucially, income now hangs off S and P, not off E.
Do not do the PhD. And the start-up is never founded either — "no start-up" wins the inner max in every branch.
Changing the income model has reversed the decision, because the doctorate's only surviving route to income is a 0.001 chance at the prize, which does not repay 50 000.
The income distribution now depends on start-up choice rather than education. This changes the model, not just the option set. Merely adding an optional action to an unchanged decision problem cannot reduce its maximum expected utility.
Lecture 3 · Bayesian Networks89 / 114
ACT 4From belief to decisionLecture 3
The value of information
If the decision can wait, it may pay to observe something first. Let EU∗(o)=maxaEU(a∣o) be the value of deciding well given what is known. Then observing a new variable is worth
VOI(Onew∣o)=(onew∑P(onew∣o)EU∗(onew,o))−EU∗(o)
the expected value of the better decision the observation lets you make, minus what you would have got anyway. With the same available actions and the option to ignore the observation, its expected value is nonnegative. It must be weighed against the cost of the observation, which the formula does not include.
Where you will meet this againLecture 4
"How much is it worth to look here?" is precisely the question an acquisition function answers in Bayesian optimisation. The knowledge gradient measures improvement in the value of a final recommendation. Expected improvement instead measures expected improvement over an incumbent; both guide queries, but they are different objectives. Act 4 has already written the formula.
Lecture 3 · Bayesian Networks90 / 114
ACT 4From belief to decisionLecture 3
A decision and the value of looking firstillustrative maintenance costs; this is a utility calculation
A machine is faulty with probability 0.2. Running it earns utility 10 if healthy and −30 if faulty. Stopping gives utility 0.
Decide without a test
EU(run)=0.8(10)+0.2(−30)=2.
Run is better than stop, so the best expected utility is 2.
A perfect test before deciding
If healthy, run; if faulty, stop.
EU(test then decide)=0.8(10)+0.2(0)=8.
The information is worth 8−2=6 before paying for the test.
Information matters because it can change the action. A test costing 7 utility units is not worth buying here; a cost of 3 gives a net gain of 3.
Lecture 3 · Bayesian Networks91 / 114
ACT 4From belief to decisionLecture 3
Sequential decisions — average, observe, then choose again
Decisions above states, utilities below; later decisions are still pending.
At d1, average the uncertain x2. Once x2 is known, choose d2. The order of sums and maxima follows this information sequence.
Source alignment: original PDF p. 87.
Lecture 3 · Bayesian Networks92 / 114
ACT 4From belief to decisionLecture 3
From an influence diagram to an MDP — state the extra assumptions
A sequential influence diagram records what is known before each decision. For additive utility, let ht contain the observed history and define the best remaining value by
If st contains all information relevant to the next transition and reward, replace the history with st. This gives the finite-horizon MDP recursion used in Lecture 7.
Hidden physical state
An observation may not be a sufficient state. A belief bt(s)=P(st=s∣ht) can serve as the information state in a partially observed model. This is why filtering matters.
The common structure is choose an action, average unknown outcomes, then choose again with the new information. A general influence diagram does not become a fully observed MDP merely by adding a time index.
Lecture 3 · Bayesian Networks93 / 114
ACT 4From belief to decisionLecture 3
Check — the Bellman equation, four lectures early
An influence diagram adds decision and utility nodes to the network. Evaluating one alternates which two operations?
You average over what you cannot control and maximise over what you can, in the order the information actually arrives. That alternating ∑max∑max is the structure of the Bellman equation, met here in a one-shot setting. Lecture 7 adds a Markov state, a transition model, and a return objective so that this pattern becomes an MDP recursion.
Lecture 3 · Bayesian Networks94 / 114
CLOSING
Closing
Belief structured, and action attached. Two roads lead out of here, and they are the rest of the course.
We can now represent belief over a whole system as a graph, read its independences off the missing edges, answer questions within it by elimination or by sampling, and — newly — attach a decision and a value to it.
This lecture hands on structured belief, plus decision and utility nodes — the influence diagram, a precursor to MDPs.
Lecture 4 — belief that acts
Put belief to work on an unknown function. A Gaussian process specifies consistent Gaussian distributions over function values. A Bayesian optimiser uses that uncertainty to choose measurements; EI and value-of-information criteria answer related but different questions.
Lecture 7 — belief through time
Unroll the decision network. One decision becomes a sequence, the utility node becomes a reward per step, and argmaxaEU becomes the Bellman optimality operator.
Lecture 3 · Bayesian Networks96 / 114
A joint distribution over a system is unmanageable — until conditional independence draws it as a graph.
Small local tables in place of one exponential one; sums that factor because the edges are missing; and then a decision node and a value node, which together are, in miniature, every decision problem still to come.
Questions?
Remember the decision network. It is the static, one-shot ancestor of the MDP, of dynamic programming, and of the reinforcement learner — belief, action and value, before time enters the picture.
APPENDIX
Backup slides
The complete arguments, kept out of the narrative.
APPENDIXBackup slidesLecture 3
Reading guide — representation, inference, learning and decisionsone main idea to explain, one comparison, one application
What factorization and independence claims does a graph encode?
Compare
Discrete HMM filtering versus the linear Gaussian Kalman update
Which quantities change when a state becomes continuous?
Apply
The original alarm, aircraft and PhD-decision examples
Which question asks for a probability, a learned model, or an action?
The book is a reference for selected concepts. The core exercise is a small factorization and one predict–observe–update step; structure search and advanced time-series models are second-pass reading.
Lecture 3 · Bayesian Networks100 / 114
APPENDIXBackup slidesLecture 3
Backup 1 — variable elimination, step by step
Query P(B∣d1,c1) on p(B,S,E,D,C)=p(B)p(S)p(E∣B,S)p(D∣E)p(C∣E). Write each conditional table as a factor over its variables:
T1(B)T2(S)T3(E,B,S)T4(D,E)T5(C,E)
Insert the evidence. Fix D=d1 and C=c1, which reduces T4 and T5 to factors over E alone: T6(E)=T4(d1,E), T7(E)=T5(c1,E).
Eliminate E. Multiply every factor mentioning E and sum it out: T8(B,S)=∑eT3(e,B,S)T6(e)T7(e).
Eliminate S.T9(B)=∑sT2(s)T8(B,s).
Combine and normalise.P(B∣d1,c1)∝T1(B)T9(B).
Cost. Each elimination creates an intermediate factor whose size is 2k where k is the number of variables it couples — the induced width of the chosen ordering. A good ordering keeps every factor small; a bad one can build a factor over most of the network. Finding the optimal ordering is NP-hard, so heuristics (min-fill, min-degree) are used. This is the practical ceiling of exact inference, and the reason sampling exists.
Lecture 3 · Bayesian Networks101 / 114
APPENDIXBackup slidesLecture 3
Backup 2 — approximate inference, and where each method breaks
method
how it works
where it breaks
Direct (rejection) sampling
draw whole assignments in topological order; discard those disagreeing with the evidence
rare evidence throws away almost every sample
Likelihood weighting
clamp the evidence, weight each sample by ∏P(xi∣pai) over the clamped nodes
the non-evidence variables are still drawn from their priors, so a rare cause is never proposed
Gibbs sampling
redraw each variable from its conditional given all the others; discard a burn-in
correct in the limit, but can mix arbitrarily slowly
The likelihood-weighting counter-example. Take C→D with p(c1)=0.001, p(d1∣c1)=0.999, p(d1∣c0)=0.001, so that exactly p(c1∣d1)=0.999×0.001+0.001×0.9990.999×0.001=0.5. A 1,000-draw run has probability 0.9991000≈0.368 of never proposing c1, in which case the estimate is zero. The normalised weighted estimator is generally biased at finite sample sizes but consistent under suitable support conditions; rare important samples can make convergence slow.
Lecture 3 · Bayesian Networks102 / 114
APPENDIXBackup slidesLecture 3
Backup 3 — from maximum expected utility to Bellman
One decision. Chance variables X with a Bayesian network, a decision D, a utility U(D,X). Given evidence e,
with L the chance variables and T the utility variables.
The translation. Let each decision move a state, p(xt+1∣xt,dt); let utility accumulate as a per-step reward, ∑tu(xt). Then MEU becomes the value function V∗, the alternating ∑max becomes the dynamic-programming recursion, and argmaxdEU becomes the Bellman optimality operator. Lecture 7 adds a discount factor γ and an infinite horizon; Lecture 8 removes p and estimates the expectation from samples. The object itself was built here.
Lecture 3 · Bayesian Networks103 / 114
APPENDIXBackup slidesLecture 3
Changing coefficients — a hidden process above the observations
The upper coefficient chain drives the lower autoregressive observations.
A changing coefficient is a hidden state to infer. It is different from fitting one fixed regression coefficient.
Source alignment: original PDF p. 68.
Lecture 3 · Bayesian Networks104 / 114
APPENDIXBackup slidesLecture 3
Backup — when the time-series model itself changesExtensions to the AR model
What changes?
A model for the change
Interpretation
AR coefficients
at=at−1+ηt, xt=ht⊤at+ϵt
infer slowly changing coefficients as hidden states
Innovation variance: ARCH
σt2=ω+∑iαiϵt−i2
recent large residuals predict more variability
Innovation variance: GARCH
σt2=ω+∑iαiϵt−i2+∑jβjσt−j2
past variance also persists
Use ω>0 and nonnegative variance coefficients; stationarity requires additional parameter restrictions. A changing coefficient, a changing state, and changing observation noise are different modelling choices.
These are extensions of the same graphical model. Bayesian updating estimates the quantities the model allows to vary; it does not make a fixed model automatically adapt to every kind of change.
Source alignment: original PDF pp. 68–70.
Lecture 3 · Bayesian Networks105 / 114
APPENDIXBackup slidesLecture 3
Changing variance — ARCH and GARCH side by side
Variance is modelled explicitly in the upper row.
ARCH uses past squared residuals. GARCH also carries past conditional variance forward.
Source alignment: original PDF p. 70.
Lecture 3 · Bayesian Networks106 / 114
EXTENSION
Extensions — model classes and structure learning
Read after completing the main route.
EXTENSIONExtensions — model classes and structure learningLecture 3
Hybrid networks — a table is not the only local modelAircraft example
The source network mixes wing spanW (continuous), military typeM (binary), radar cross sectionC (continuous), and detectionD (binary).
p(w,m,c,d)=p(w)p(m)p(c∣w,m)p(d∣c).
Node
A possible local model
Meaning
W
N(μW,σW2)
distribution of wing spans
M
Bernoulli probability θ
frequency of the aircraft type
C∣W,M=m
N(amW+bm,σm2)
each type has its own regression
D∣C
P(D=1∣C)=1/(1+e−(C−c0)/b), b>0
detection becomes more likely as the cross section grows
The graph factorisation stays the same. Sum discrete hidden variables and integrate continuous ones. Non-Gaussian factors can require approximate inference.
Source alignment: original PDF pp. 39–42.
Lecture 3 · Bayesian Networks108 / 114
EXTENSIONExtensions — model classes and structure learningLecture 3
A continuous root — wing span
The graph stays fixed while the highlighted local model changes.
The highlighted root W has a Gaussian density. It is a continuous variable, so its local model is not a finite table.
Source alignment: original PDF p. 39, pp. 39–42.
Lecture 3 · Bayesian Networks109 / 114
EXTENSIONExtensions — model classes and structure learningLecture 3
A discrete root — aircraft type
The graph stays fixed while the highlighted local model changes.
The highlighted root M is binary, so one Bernoulli parameter specifies its local distribution.
Source alignment: original PDF p. 40, pp. 39–42.
Lecture 3 · Bayesian Networks110 / 114
EXTENSIONExtensions — model classes and structure learningLecture 3
A conditional Gaussian — radar cross section
The graph stays fixed while the highlighted local model changes.
The highlighted C depends on wing span and type. Each type selects its own linear Gaussian regression.
Source alignment: original PDF p. 41, pp. 39–42.
Lecture 3 · Bayesian Networks111 / 114
EXTENSIONExtensions — model classes and structure learningLecture 3
A binary observation — detection probability
The graph stays fixed while the highlighted local model changes.
The highlighted D is binary. Its probability changes smoothly with continuous radar cross section C.
Source alignment: original PDF p. 42, pp. 39–42.
Lecture 3 · Bayesian Networks112 / 114
EXTENSIONExtensions — model classes and structure learningLecture 3
Learning the graph — compare explanations, not just fitted tablesTructure learning
If the arrows are unknown, the candidate model is the graph G as well as its parameters θ:
P(G∣D)∝P(G)p(D∣G), the model evidence∫p(D∣θ,G)p(θ∣G)dθ.
Propose a graphadd, remove, or reverse an edge while keeping a DAG
Score itcombine prior preference and fit averaged over parameters
Comparekeep a better candidate and continue the search
Exhaustively checking every DAG is usually impractical. Search can stop at a local solution, and different graphs may encode the same observational independences.
Inference: unknown variables in a fixed model. Parameter learning: unknown tables. Structure learning: unknown arrows. An observational graph alone does not establish causality.
Source alignment: original PDF p. 45.
Lecture 3 · Bayesian Networks113 / 114
EXTENSIONExtensions — model classes and structure learningLecture 3
Continuous time-series data — regression becomes a transition modelTime is discrete; the state is continuous
Lagged observations point to the next value.
An AR(L) model uses the last L values as regression features:
xt=a⊤ht+ϵt,ht=[xt−1,…,xt−L]⊤,ϵt∼N(0,σ2).
Lecture 2's regression now specifies a transition model. Gaussian MLE still minimises ∑t(xt−a⊤ht)2.
AR(2) is generally not first-order Markov in xt. It is first-order in [xt,xt−1]. Choose a state that keeps the information needed for prediction.
Source alignment: original PDF pp. 63–67, p. 66.
Lecture 3 · Bayesian Networks114 / 114
IE437 · Lecture 3 — Bayesian Networks
1Bayesian Networks
2Where we are — one unknown becomes many
3Learning route — from a joint probability to a decision
Act 1 — the joint as a graph
5A joint, written out in full
6First read the arrows — directed and undirected graphs
7A directed acyclic graph, and the words for reading one
8Read one graph three ways — nodes, edges and a matrix
9A satellite — two causes and two visible symptoms
10The factorisation — one joint, written locally
11Multiply first, then sum — a two-node calculation
12The collapse, in numbers
13The wall — a joint distribution is exponentially large
14Every distribution is a Bayesian network — and that is the catch
15Check — where the saving comes from
Act 2 — what the graph encodes
17Conditional independence — the meaning of a missing edge
18See why the collider is different
19Three structures, three verdicts
20Marginalize or condition — watch the connection change
21Explaining away — the collider, in words
22Wet grass — the graph and its probability tables
23Wet grass — explaining away, with numbers
24Evidence, entered by hand
25Burglar alarm — two competing explanations
26The burglar alarm — the same move, sharper
27What the missing edges buy
28Check — the collider
Act 3 — reasoning with the network
30The query, and three kinds of variable
31Exact inference — and why it hurts
32A factor covers the variables in one local table
33Variable elimination — push each sum past what it cannot touch
34The same thing as tables — eliminate E, then S
35The cost is the largest table you build — and the order decides it
36What the ordering is worth
37Generate one sample — 1/5 · Draw the battery
38Generate one sample — 2/5 · Draw the solar panel
39Generate one sample — 3/5 · Draw the electrical state
40Generate one sample — 4/5 · Draw the trajectory
41Generate one sample — 5/5 · Draw communication
42Reject rows that disagree with the evidence
43Weight the evidence instead of rejecting a row
44How different a 0.72 and a 0.02 really are
45Three rows, weighed instead of counted
46Why B, S and E carry no weight of their own
47Why the weighted vote is the right answer
48Rare causes — why weighting can still struggle
49When exact inference is hopeless — sample
50Check — cheap to store, cheap to use?
51Naive Bayes — classification is posterior inference
Learning a model from data
53Learning the tables — reuse Lecture 2 locally
Tracking a hidden state through time
55A dynamic Bayesian network — repeat the same local structure
56The same graph, unrolled through time
57Markov order — how far back do the arrows reach?
58Fit a transition matrix — count where each state goes
59Predict a marginal — collect probability from every predecessor
60A stationary model need not start in a stationary distribution
61State transitions — a graph of possible next states
62Hidden Markov models — name the question before computing
63Filtering — locate the present
64Prediction — look beyond the observations
65Smoothing — use later evidence to revise the past