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.
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?
AA BB CC P(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=82^3 = 8 rows — every combination AA, BB and CC can take. The last is forced by the others, so 23−1=72^3-1 = 7 free numbers.

The table is complete: every question about AA, BB and CC 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 AA is irrelevant to CC once BB 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.
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.
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→AA\to B\to C\to A returns to AA; 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.
The same eight-node graph, edge list and adjacency matrix.
Read arrows entering x4x_4: its parents are x1,x2,x3x_1,x_2,x_3. Follow arrows leaving it: its children are x5,x6x_5,x_6.

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.
Retain the diamond-shaped system diagram.
Battery BB and solar panel SS feed electrical state EE; EE feeds trajectory DD and communication CC. 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)p(x_1,\ldots,x_n)=\prod_i p(x_i\mid\mathrm{pa}_i) on a DAG.

Each table sits beside the node whose local distribution it specifies.
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).p(B,S,E,D,C)=p(B)p(S)p(E\mid B,S)p(D\mid E)p(C\mid E).

Free parameters: 1+1+4+2+2=101+1+4+2+2=10, compared with 25−1=312^5-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 FF mean a machine fault and AA mean an alarm: F→AF\to A. Use P(F)=0.1P(F)=0.1, P(A∣F)=0.8P(A\mid F)=0.8, P(A∣¬F)=0.2P(A\mid\neg F)=0.2.

Case Local probabilities Joint probability
Fault and alarm 0.1×0.80.1\times0.8 0.080.08
No fault and alarm 0.9×0.20.9\times0.2 0.180.18

The alarm probability sums both possible causes: P(A)=0.08+0.18=0.26P(A)=0.08+0.18=0.26.

P(F∣A)=P(F,A)P(A)=0.080.26≈0.308.P(F\mid A)=\frac{P(F,A)}{P(A)}=\frac{0.08}{0.26}\approx0.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−12^n-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 nn and watch the gap open; the satellite sits at n=5n=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 nn binary variables the joint p(x1,…,xn)p(x_1,\dots,x_n) is a table of 2n2^n rows, so specifying it takes

2n−1independent numbers(Mn−1 if each variable has M values)2^n - 1 \quad\text{independent numbers} \qquad (M^n - 1 \text{ if each variable has } M \text{ 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:

p(x1,…,xn)=p(xn∣x1,…,xn−1) p(xn−1∣x1,…,xn−2)⋯p(x1)p(x_1,\dots,x_n) = p(x_n\mid x_1,\dots,x_{n-1})\,p(x_{n-1}\mid x_1,\dots,x_{n-2})\cdots p(x_1)

which is a Bayesian network — on the fully connected DAG. It costs exactly 2n−12^n-1 numbers and buys nothing.

The saving is not in the factorisation. It is in the edges you leave out.

p(C∣E)p(C \mid E) rather than p(C∣E,B,S,D)p(C \mid 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,CD,C can still change our belief about EE, even when B,SB,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))\prod_i p(x_i \mid \mathrm{pa}(x_i)). Where does the reduction from 2n2^n numbers actually come from?

The chain rule p(x1)p(x2∣x1)p(x3∣x1,x2)⋯p(x_1)p(x_2 \mid x_1)p(x_3 \mid x_1,x_2)\cdots 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)X \perp Y \iff p(X,Y) = p(X)p(Y)

equivalently p(X∣Y)=p(X)p(X\mid Y) = p(X): learning YY tells you nothing about XX.

Conditional independence

X⊥Y∣Z  ⟺  p(X,Y∣Z)=p(X∣Z) p(Y∣Z)X \perp Y \mid Z \iff p(X,Y\mid Z) = p(X\mid Z)\,p(Y\mid Z)

equivalently p(X∣Y,Z)=p(X∣Z)p(X\mid Y,Z) = p(X\mid Z): once you know ZZ, learning YY tells you nothing further about XX.

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∣EC \perp B \mid 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∣ED \perp S \mid E.

That single sentence is what the missing edges B→CB \to C and S→DS \to D mean. This is also why the binary conditional p(C∣E)p(C \mid 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.
Blue: conditioning separates; red: conditioning can couple.
The three blue rows factor after observing zz. In the red row, p(z∣x,y)p(z\mid 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 XX and YY are independent depends on the shape and on whether the middle node is observed.

structure shape X⊥YX \perp Y with ZZ unobserved X⊥YX \perp Y given ZZ
chain X→Z→YX \to Z \to Y not guaranteed yes
fork (common cause) X←Z→YX \leftarrow Z \to Y not guaranteed yes
collider (common effect) X→Z←YX \to Z \leftarrow 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:

fork: p(x,y∣z)=p(x∣z)p(y∣z),collider: p(x,y∣z)=p(x)p(y) p(z∣x,y)p(z)  ≢  p(x∣z)p(y∣z).\begin{aligned} \text{fork: }\quad p(x,y\mid z)&=p(x\mid z)p(y\mid z),\\ \text{collider: }\quad p(x,y\mid z)&=\frac{p(x)p(y)\,\hl{p(z\mid x,y)}}{p(z)}\;\not\equiv\;p(x\mid z)p(y\mid z). \end{aligned}

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.
Left: common cause; right: common effect.
Crossed-out zz: sum it out. Shaded zz: 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.
The electrical failure is observed; the competing causes are highlighted.

Before: BB and SS are independent. Observe EE: the electrical system failed. Then learn BB failed: in a competing-causes model, less evidence is needed for SS to explain EE.

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 .
Graph above, local probability tables below; the table label is corrected to p(T∣R,S)p(T\mid 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

SS sprinkler on · RR raining · TT Tracey's grass wet · JJ Jack's grass wet

S→T←R→JS \to T \leftarrow R \to J
p(T,J,R,S)=p(T∣R,S) p(J∣R) p(R) p(S)p(T,J,R,S) = p(T\mid R,S)\,p(J\mid R)\,p(R)\,p(S)

p(S=1)=0.1p(S{=}1) = 0.1, p(R=1)=0.2p(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)=1p(J{=}1\mid R{=}1)=1, p(J=1∣R=0)=0.2p(J{=}1\mid R{=}0)=0.2.

The two queries

p(S=1)=0.100p(S{=}1) = \hl{0.100}
p(S=1∣T=1)=0.0920.272=0.338p(S{=}1\mid T{=}1) = \frac{0.092}{0.272} = \hl{0.338}
p(S=1∣T=1,J=1)=0.03440.2144=0.160p(S{=}1\mid T{=}1,J{=}1) = \frac{0.0344}{0.2144} = \hl{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 JJ is not on the collider path at all; it is a child of RR. It moves the answer only because it moves RR, and RR competes with SS to explain TT. Note also that p(S=1∣J=1)=0.100p(S{=}1 \mid J{=}1) = 0.100 exactly — with TT 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←RS \to T \leftarrow R; they light when observing TT opens it. The readout is the exact posterior over the sprinkler, computed by enumerating all sixteen states. Observe TT alone and the collider opens; add JJ and the rain explains the sprinkler away; observe RR 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 .
The first prior label is corrected to P(B=1)=0.01P(B=1)=0.01.
The alarm has two parents. A radio report is evidence about earthquake EE; after hearing the alarm, it can change our belief about burglary BB.

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

BB burgled · EE earthquake · AA alarm sounds · RR radio reports a quake

B→A←E→RB \to A \leftarrow E \to R

p(B=1)=0.01p(B{=}1) = 0.01, p(E=1)=10−6p(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.01p(B{=}1) = 0.01
p(B=1∣A=1)=0.99p(B{=}1 \mid A{=}1) = \hl{0.99}
p(B=1∣A=1,R=1)=0.01p(B{=}1 \mid A{=}1, R{=}1) = \hl{0.01}

The alarm makes a burglary near-certain. One radio bulletin — which says nothing about burglars — sends it straight back to the prior.

RR is not connected to BB 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−12^n-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←YX \to Z \leftarrow Y. What is the relationship between XX and YY?

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.
ACT 3Reasoning with the networkLecture 3

The query, and three kinds of variable

Orange: query; green: observed evidence; white: hidden variables.
Orange: query; green: observed evidence; white: hidden variables.
P(B∣D=1,C=1)P(B\mid D=1,C=1)

Keep BB as the query. Fix D,CD,C at their observed values. Sum over E,SE,S, then normalise.

Source alignment: original PDF p. 25.

Lecture 3 · Bayesian Networks30 / 114
ACT 3Reasoning with the networkLecture 3

Exact inference — and why it hurts

Marginalise the joint over the hidden variables and normalise:

P(b1∣d1,c1)  ∝  ∑s∑eP(b1)P(s)P(e∣b1,s)P(d1∣e)P(c1∣e)P(b^1\mid d^1,c^1) \;\propto\; \sum_{s}\sum_{e} P(b^1)P(s)P(e\mid b^1,s)P(d^1\mid e)P(c^1\mid e)

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.
Each outline groups the variables of one factor.
The large outline covers E,B,SE,B,S: it is p(E∣B,S)p(E\mid B,S). Eliminating EE combines every factor that mentions EE.

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) has no s and no e=  P(b1)∑sP(s) ∑e  P(e∣b1,s) P(d1∣e) P(c1∣e)P(s) has no e\begin{aligned} P(b^1\mid d^1,c^1)\;&\propto\;\sum_{s}\sum_{e}\;P(b^1)\,P(s)\,P(e\mid b^1,s)\,P(d^1\mid e)\,P(c^1\mid e)\\[3pt] &=\;P(b^1)\sum_{s}\sum_{e}\;P(s)\,P(e\mid b^1,s)\,P(d^1\mid e)\,P(c^1\mid e) &&\text{$P(b^1)$ has no $s$ and no $e$}\\[3pt] &=\;P(b^1)\sum_{s}P(s)\,\hl{\sum_{e}\;P(e\mid b^1,s)\,P(d^1\mid e)\,P(c^1\mid e)} &&\text{$P(s)$ has no $e$} \end{aligned}

The value has not changed. What has changed is how often each product is formed: the inner sum is a function of ss alone once b1b^1 is fixed, so it is computed once per value of ss — not once per pair (s,e)(s,e).

Every rearrangement is a choice of which variable to sum out first. Here ee goes first, then ss; 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\sum_s innermost; the deck sums ee first so that this slide, the factor slide and the T8T_8 definition all use the same elimination order.

Lecture 3 · Bayesian Networks33 / 114
ACT 3Reasoning with the networkLecture 3

The same thing as tables — eliminate EE, then SS

Write each conditional distribution as a factor, a table over the variables it mentions, and run the rearrangement as three table operations.

startT1(B)  T2(S)  T3(E,B,S)  T4(D,E)  T5(C,E)fix the evidenceT1(B)  T2(S)  T3(E,B,S)  T6(E)  T7(E)keep only the d1 row of T4, the c1 row of T5eliminate ET1(B)  T2(S)  T8(B,S)T8(B,S)=∑eT3(e,B,S) T6(e) T7(e)eliminate ST1(B)  T9(B)T9(B)=∑sT2(s) T8(B,s)\begin{aligned} &\text{start}&& T_1(B)\;T_2(S)\;T_3(E,B,S)\;T_4(D,E)\;T_5(C,E)\\[2pt] &\text{fix the evidence}&& T_1(B)\;T_2(S)\;T_3(E,B,S)\;T_6(E)\;T_7(E) &&\text{keep only the $d^1$ row of $T_4$, the $c^1$ row of $T_5$}\\[2pt] &\text{eliminate }E&& T_1(B)\;T_2(S)\;T_8(B,S) &&T_8(B,S)=\textstyle\sum_e T_3(e,B,S)\,T_6(e)\,T_7(e)\\[2pt] &\text{eliminate }S&& T_1(B)\;T_9(B) &&T_9(B)=\textstyle\sum_s T_2(s)\,T_8(B,s) \end{aligned}

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)=T1(b) T9(b)∑b′T1(b′) T9(b′).P(b\mid d^1,c^1)=\frac{T_1(b)\,T_9(b)}{\sum_{b'}T_1(b')\,T_9(b')}.

Source alignment: original PDF p. 27. The numbering is the source's: T6,T7T_6,T_7 are the evidence-sliced versions of T4,T5T_4,T_5, which is why the eliminations produce T8T_8 and T9T_9.

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 EE T3(E,B,S)⋅T6(E)⋅T7(E)T_3(E,B,S)\cdot T_6(E)\cdot T_7(E) over (E,B,S)(E,B,S) 23=82^3=8
eliminate SS T2(S)⋅T8(B,S)T_2(S)\cdot T_8(B,S) over (B,S)(B,S) 22=42^2=4

The largest table was 88 entries — the size of P(E∣B,S)P(E\mid 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.
Sample each variable once its parents are available.
Draw BB from p(B)p(B). This sample starts with B=1B=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.
Sample each variable once its parents are available.
Draw SS from p(S)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.
Sample each variable once its parents are available.
Now both parents are available: draw EE from p(E∣B=1,S=1)p(E\mid 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.
Sample each variable once its parents are available.
Draw DD from p(D∣E=1)p(D\mid 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.
Sample each variable once its parents are available.
Draw CC from p(C∣E=1)p(C\mid 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 .
Three of the nine displayed rows match D=C=1D=C=1.
Among the three matching rows, one has B=1B=1: the sample estimate is 1/31/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 columns were never sampled; the last column is what each row pays.
The red D,CD,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 DD and CC at all, only to check them against values we already know. So do not sample them — write D=1D=1, C=1C=1 straight into every row.

That is cheating, and the weight is the price. A row whose sampled EE would have produced D=C=1D=C=1 on its own has earned them; a row whose EE makes them improbable was handed them. So each row counts in proportion to how plausibly it could have produced the evidence:

w=P(D=1∣E)⏟how likely this row’s E makes D=1  ⋅  P(C=1∣E)⏟and C=1w=\underbrace{P(D=1\mid E)}_{\text{how likely this row's }E\text{ makes }D=1}\;\cdot\;\underbrace{P(C=1\mid E)}_{\text{and }C=1}
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 EE appears in the weight because, by the factorisation of Act 1, EE is the only parent DD or CC 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→DE\to D and E→CE\to C illustrative tables: P(D=1∣E=1)=0.9P(D{=}1\mid E{=}1)=0.9, P(C=1∣E=1)=0.8P(C{=}1\mid E{=}1)=0.8, and P(D=1∣E=0)=0.1P(D{=}1\mid E{=}0)=0.1, P(C=1∣E=0)=0.2P(C{=}1\mid E{=}0)=0.2.

w(E=1)=0.9×0.8=0.72w(E=0)=0.1×0.2=0.02w(E{=}1)=0.9\times0.8=0.72 \qquad\qquad w(E{=}0)=0.1\times0.2=0.02
A row with E=1E=1 explains D=C=1D=C=1 thirty-six times more plausibly than a row with E=0E=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

BB SS EE weight w=P(D=1∣E)P(C=1∣E)w=P(D{=}1\mid E)P(C{=}1\mid E)
11 00 11 0.9×0.8=0.720.9\times0.8=0.72
00 11 11 0.9×0.8=0.720.9\times0.8=0.72
00 11 00 0.1×0.2=0.020.1\times0.2=0.02
P^(B=1∣D=C=1)=0.720.72+0.72+0.02=0.721.46≈0.493.\widehat P(B{=}1\mid D{=}C{=}1)=\frac{0.72}{0.72+0.72+0.02}=\frac{0.72}{1.46}\approx\mathbf{0.493}.
Not 1/31/3. The earlier rejection-sampling count gave every surviving row one vote regardless of how well it explained the evidence. The row with E=0E=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(D\mid E), P(C∣E)P(C\mid 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,EB,S,E honestly from P(B), P(S), P(E∣B,S)P(B),\,P(S),\,P(E\mid B,S) and their probabilities are already built into how many rows carry each value. With P(B=1)=0.1P(B{=}1)=0.1, roughly one row in ten already has B=1B=1 — not because a weight said so, but because that is how often the sampler drew it.

DD and CC get no such chance: they are never drawn, only decreed to be 11 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(B), P(S)P(S) and P(E∣B,S)P(E\mid B,S) never reappear inside ww.

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)(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:

P(b) P(s) P(e∣b,s)⏟how often the row is drawn  ×  P(D=1∣e) P(C=1∣e)⏟its weight  =  P(b,s,e,D=1,C=1).\underbrace{P(b)\,P(s)\,P(e\mid b,s)}_{\text{how often the row is drawn}}\;\times\;\underbrace{P(D=1\mid e)\,P(C=1\mid e)}_{\text{its weight}}\;=\;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=1B=1, against the weights over all rows, cancels the constant P(D=1,C=1)P(D=1,C=1):

P^(B=1∣D=C=1)=∑kwk 1[Bk=1]∑kwk  ⟶  P(B=1, D=1,C=1)P(D=1,C=1).\widehat P(B=1\mid D=C=1)=\frac{\sum_k w_k\,\mathbf 1[B_k=1]}{\sum_k w_k}\;\longrightarrow\;\frac{P(B=1,\,D=1,C=1)}{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 can have posterior probability 0.5 after observing .
A rare cause CC can have posterior probability 0.5 after observing D=1D=1.

But likelihood weighting still proposes C=1C=1 with probability 0.001. In 1,000 draws, the probability of missing it entirely is 0.9991000≈0.3680.999^{1000}\approx0.368.

A run with no C=1C=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)p(x_i \mid \mathrm{pa}_i); keep only the runs that happen to match the evidence, and count.

Nine samples of the satellite network, three of which show d1,c1d^1, c^1, one of those with b1b^1:

P^(b1∣d1,c1)=1/3\hat P(b^1 \mid d^1,c^1) = 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)w \leftarrow w \times P(x_i \mid \mathrm{pa}_i) for the clamping.

A different failure mode. Take C→DC \to D with p(c1)=0.001p(c^1) = 0.001, p(d1∣c1)=0.999p(d^1\mid c^1) = 0.999, p(d1∣c0)=0.001p(d^1 \mid c^0) = 0.001. The exact posterior is p(c1∣d1)=0.5p(c^1\mid d^1) = \hl{0.5}. But CC is still drawn from its prior. The chance of seeing no c1c^1 in 1,000 draws is 0.9991000≈0.3680.999^{1000}\approx0.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.
One class node, many observed features.

Given class CC, the features are conditionally independent:

P(C=c∣o1:n)∝P(C=c)∏iP(oi∣C=c).P(C=c\mid o_{1:n})\propto P(C=c)\prod_iP(o_i\mid C=c).

For an illustrative two-class, two-feature problem:

Class Prior × first-feature likelihood × second-feature likelihood Unnormalised score
AA 0.4×0.8×0.50.4\times0.8\times0.5 0.160.16
BB 0.6×0.2×0.50.6\times0.2\times0.5 0.060.06

Thus P(A∣o1,o2)=0.16/0.22≈0.727P(A\mid o_1,o_2)=0.16/0.22\approx0.727. Choose AA 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)=Nijk∑k′Nijk′.\hat p(X_i=k\mid\mathrm{pa}_i=j)=\frac{N_{ijk}}{\sum_{k'}N_{ijk'}}.

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)P(A=1\mid F=1) 8/10=0.88/10=0.8 9/12=0.759/12=0.75
P(A=1∣F=0)P(A=1\mid F=0) 18/90=0.218/90=0.2 19/92≈0.20719/92\approx0.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.
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.

P(S1,…,ST)=P(S1)∏t=2TP(St∣S1:t−1)→ two assumptions P(S1)∏t=2TP(St∣St−1)P(S_1,\dots,S_T) = P(S_1)\prod_{t=2}^{T} P(S_t \mid S_{1:t-1}) \quad\xrightarrow{\ \text{two assumptions}\ }\quad P(S_1)\prod_{t=2}^{T}P(S_t\mid S_{t-1})

1 · The Markov assumption

P(St∣S1,…,St−1)=P(St∣St−1)P(S_t \mid S_1,\dots,S_{t-1}) = P(S_t \mid S_{t-1})

the future is conditionally independent of the past given the present, St+1⊥S1:t−1∣StS_{t+1} \perp S_{1:t-1} \mid S_t. 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)    ∀tP(S_{t+1}{=}s'\mid S_t{=}s) = P(S'{=}s'\mid S{=}s) \;\; \forall t

one transition table, shared by every time step, instead of TT 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.
Without an assumption, a state may depend on the whole past.
First-order and second-order chains, side by side.
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)M_{ij}=P(S_{t+1}=i\mid S_t=j): column jj is the distribution of the next state given the current state.

Five departures from state 1; three go to state 3, giving .
Five departures from state 1; three go to state 3, giving θ^3∣1=3/5\hat\theta_{3\mid1}=3/5.

For the illustrative observed sequence A,A,B,A,B,BA,A,B,A,B,B, the four transition counts are NAA=1N_{AA}=1, NBA=2N_{BA}=2, NAB=1N_{AB}=1, NBB=1N_{BB}=1.

M^=[1/31/22/31/2],pt+1=M^pt.\hat M=\begin{bmatrix}1/3&1/2\\2/3&1/2\end{bmatrix},\qquad p_{t+1}=\hat M p_t.

Starting at AA gives pt=[1,0]⊤p_t=[1,0]^\top, so the next-state probabilities are [1/3,2/3]⊤[1/3,2/3]^\top. Every column sums to one.

This is model learning from a trajectory. Predicting with pt+1=Mptp_{t+1}=Mp_t 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.
Each blue arrow contributes transition probability times previous-state probability.
P(St=i)=∑jP(St=i∣St−1=j)P(St−1=j),pt=Mpt−1.P(S_t=i)=\sum_j P(S_t=i\mid S_{t-1}=j)P(S_{t-1}=j),\qquad p_t=Mp_{t-1}.
Add all routes into state ii. 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 MM is used at each step. Stationary distribution: a probability vector p∞p_\infty satisfying Mp∞=p∞Mp_\infty=p_\infty.

For a separate illustrative two-state model,

M=[0.90.20.10.8],p∞=[2/31/3].M=\begin{bmatrix}0.9&0.2\\0.1&0.8\end{bmatrix},\qquad p_\infty=\begin{bmatrix}2/3\\1/3\end{bmatrix}.

From p0=[1,0]⊤p_0=[1,0]^\top, the first two distributions are p1=[0.9,0.1]⊤p_1=[0.9,0.1]^\top and p2=[0.83,0.17]⊤p_2=[0.83,0.17]^\top: the marginal distribution changes even though MM 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.
These four nodes are state values, not four time steps.
From X2X_2, move to X3X_3 with probability 0.4 or X4X_4 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.
Blue transitions, red emissions and grey observed nodes.
Question Target What the answer uses
Filtering p(xt∣y1:t)p(x_t\mid y_{1:t}) observations available now
Prediction p(xt+h∣y1:t)p(x_{t+h}\mid y_{1:t}) current belief, propagated into the future
Smoothing p(xt∣y1:T)p(x_t\mid y_{1:T}), t<Tt<T later observations to revise the past
Sequence likelihood / best hidden path p(y1:T)p(y_{1:T}) / arg max⁡x1:Tp(x1:T∣y1:T)\argmax_{x_{1:T}}p(x_{1:T}\mid y_{1: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

· original observation shading and target highlights.
p(xt∣y1:t)p(x_t\mid y_{1: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

· original observation shading and target highlights.
p(xt∣y1:s), t>sp(x_t\mid y_{1:s}),\ t>s · original observation shading and target highlights.
The observations stop at ss. 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

· original observation shading and target highlights.
p(xt∣y1:u), t<up(x_t\mid y_{1:u}),\ t<u · original observation shading and target highlights.
The target stays at tt, but grey observations extend to uu. 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

· original observation shading and target highlights.
arg max⁡x1:up(x1:u∣y1:u)\argmax_{x_{1:u}}p(x_{1:u}\mid y_{1: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→YtX_t \to Y_t over a chain Xt−1→XtX_{t-1}\to X_t — and you have a hidden Markov model. The standard query is filtering, the belief about now given everything seen so far:

P(xt∣y1:t)  ∝  P(yt∣xt)⏟corrector∑xt−1P(xt∣xt−1) P(xt−1∣y1:t−1)⏟predictorP(x_t\mid y_{1:t}) \;\propto\; \underbrace{P(y_t\mid x_t)}_{\hl{\text{corrector}}}\sum_{x_{t-1}} \underbrace{P(x_t\mid x_{t-1})\,P(x_{t-1}\mid y_{1:t-1})}_{\hl{\text{predictor}}}

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.20.2. A fault persists with probability 0.80.8; a healthy machine develops a fault with probability 0.10.1.

Predict today's state:

P(Ft)=0.8(0.2)+0.1(0.8)=0.24.P(F_t)=0.8(0.2)+0.1(0.8)=0.24.

Now an alarm occurs, with P(At∣Ft)=0.9P(A_t\mid F_t)=0.9 and P(At∣¬Ft)=0.1P(A_t\mid\neg F_t)=0.1.

Correct using the observation:

P(Ft∣At)=0.9(0.24)0.9(0.24)+0.1(0.76)≈0.740.P(F_t\mid A_t)=\frac{0.9(0.24)}{0.9(0.24)+0.1(0.76)}\approx0.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 (GG) or weak (WW). Initially P(G)=0.6P(G)=0.6. Next-step probabilities are P(G′∣G)=0.9P(G'\mid G)=0.9 and P(G′∣W)=0.3P(G'\mid W)=0.3. A warm reading has likelihood 0.8 under G′G' and 0.2 under W′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.66P(G')=0.9(0.6)+0.3(0.4)=0.66. After a warm reading,

P(G′∣warm)=0.8(0.66)0.8(0.66)+0.2(0.34)=132149≈0.886.P(G'\mid\text{warm})=\frac{0.8(0.66)}{0.8(0.66)+0.2(0.34)}=\frac{132}{149}\approx0.886.
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′G' and 0.8 under W′W'. Calculate the new posterior.

Check your answer. P(G′∣cool)=0.132/(0.132+0.272)=33/101≈0.327P(G'\mid\text{cool})=0.132/(0.132+0.272)=33/101\approx\mathbf{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

affects both the transition and the observation.
AtA_t 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 ; the next slide uses .
The source writes the emission matrix as BtB_t; the next slide uses CC.
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 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,Ptm_t,P_t.

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

xt=Axt−1+wt,yt=Cxt+vt,wt∼N(0,Q),vt∼N(0,R).x_t=Ax_{t-1}+w_t,\qquad y_t=Cx_t+v_t,\qquad w_t\sim\mathcal N(0,Q),\quad v_t\sim\mathcal N(0,R).

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−1m_t^-=Am_{t-1}, Pt−=APt−1A⊤+QP_t^-=AP_{t-1}A^\top+Q
Weight the measurement Kt=Pt−C⊤(CPt−C⊤+R)−1K_t=P_t^-C^\top(CP_t^-C^\top+R)^{-1}
Correct belief mt=mt−+Kt(yt−Cmt−)m_t=m_t^-+K_t(y_t-Cm_t^-), Pt=(I−KtC)Pt−P_t=(I-K_tC)P_t^-

A scalar example with m−=10m^-=10, P−=4P^-=4, C=1C=1, R=1R=1, and y=12y=12 gives K=0.8K=0.8, m=11.6m=11.6 and P=0.8P=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.
Circle: chance. Square: decision. Diamond: utility. Dashed blue: information known before choosing.
Read the dashed arrow first: the result of test O1O^1 is known before treatment TT 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)U(s) to outcome ss. 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 pip_i is valued by

EU(a)=∑ipiU(si).\mathrm{EU}(a)=\sum_i p_iU(s_i).
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.
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≥0m\ge0 E[U(A)]\mathbb E[U(A)] E[U(B)]\mathbb E[U(B)] Preferred
U(m)=mU(m)=\sqrt m 11 0.01(10)=0.10.01(10)=0.1 A: risk averse
U(m)=mU(m)=m 11 0.01(100)=10.01(100)=1 indifferent: risk neutral
U(m)=m2U(m)=m^2 11 0.01(10 000)=1000.01(10\,000)=100 B: risk seeking

Same money on average, three different decisions — the shape of UU is doing all the work.

Choose by E[U(M)]\mathbb E[U(M)], which need not equal U(E[M])U(\mathbb 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.
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 HH, vertical closeness VV, and whether an alarm is raised AA.

U(h,v,a)=Useparation(h,v)+Ualarm(a).U(h,v,a)=U_{\mathrm{separation}}(h,v)+U_{\mathrm{alarm}}(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 nn binary variables Entries to specify before accounting for utility scaling
Arbitrary joint utility U(x1,…,xn)U(x_1,\ldots,x_n) 2n2^n
Additive utility ∑iUi(xi)\sum_i U_i(x_i) 2n2n
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.
Joint alarm/collision utility on the left; additive components on the right.
Unsafe horizontal and vertical separation contribute U1(h,v)U^1(h,v). Raising an alarm contributes U2(a)U^2(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 aa after observation oo, combine the belief model with the value of each outcome:

Green supplies the probability; red supplies the utility.
Green supplies the probability; red supplies the utility.
a∗=arg max⁡aEU(a∣o).a^*=\argmax_a\mathrm{EU}(a\mid 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)p=P(D=1\mid O^1) be the disease probability after reading the test. The graph supplies pp; the utility table supplies the consequences.

Choose Healthy: D=0D=0 Diseased: D=1D=1 Expected utility
No treatment 0 −10-10 −10p-10p
Treatment −1-1 −1-1 −1-1
Treat when −1>−10p-1>-10p, or p>0.1p>0.1; at p=0.1p=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.
Education changes both study cost and the income distribution.
Choose education EE first. Average over prize PP and income II, then add study cost UCU_C and income benefit UBU_B.

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

EE do PhD / no PhD is the decision; PP win the prize? and II income: low / average / high are chance; UCU_C (cost of study) and UBU_B (benefit of income) are utility.

E→P,{E,P}→I,E→UC,I→UBE \to P,\quad \{E,P\}\to I,\quad E \to U_C,\quad I \to U_B

UC(do PhD)=−50 000U_C(\text{do PhD}) = -50\,000, UC(no PhD)=0U_C(\text{no PhD}) = 0; UB=100 000/200 000/500 000U_B = 100\,000 / 200\,000 / 500\,000 for low / average / high income; p(prize∣PhD)=0.001p(\text{prize}\mid \text{PhD}) = 0.001 against 10−710^{-7} without.

The computation

U(E)=∑I,Pp(I∣E,P) p(P∣E)[UC(E)+UB(I)]U(E) = \sum_{I,P} p(I\mid E,P)\,p(P\mid E)\big[U_C(E)+U_B(I)\big]
U(do PhD)=260 174U(\text{do PhD}) = \hl{260\,174}
U(no PhD)=240 000U(\text{no PhD}) = \hl{240\,000}

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)p(I,P\mid E), the utility nodes give the value, the sum gives EU\mathrm{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.
The dashed edge says the prize is known before the start-up decision.
Read the order E≺P≺S≺IE\prec P\prec S\prec I. The income parents also change to S,PS,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 SS found a start-up? is added, with US(yes)=−200 000U_S(\text{yes}) = -200\,000, and an information edge P⇢SP \dashrightarrow S — the prize is known before the start-up is founded. Crucially, income now hangs off SS and PP, not off EE.

U(E)=UC(E)+∑Pp(P∣E)max⁡S[US(S)+∑Ip(I∣S,P)UB(I)].\begin{aligned} U(E)&=U_C(E)+\sum_P p(P\mid E)\\ &\quad\hl{\max_S}\Big[U_S(S)+\sum_I p(I\mid S,P)U_B(I)\Big]. \end{aligned}

What happens

U(do PhD)=190 195U(\text{do PhD}) = \hl{190\,195}
U(no PhD)=240 000U(\text{no PhD}) = \hl{240\,000}

Do not do the PhD. And the start-up is never founded either — "no start-up" wins the inner max⁡\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)=max⁡aEU(a∣o)\mathrm{EU}^{*}(o) = \max_a \mathrm{EU}(a\mid o) be the value of deciding well given what is known. Then observing a new variable is worth

VOI(Onew∣o)=(∑onewP(onew∣o) EU∗(onew,o))  −  EU∗(o)\mathrm{VOI}(O^{\text{new}}\mid o) = \Big(\sum_{o^{\text{new}}} P(o^{\text{new}}\mid o)\,\mathrm{EU}^{*}(o^{\text{new}}, o)\Big) \;-\; \mathrm{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.20.2. Running it earns utility 10 if healthy and −30-30 if faulty. Stopping gives utility 0.

Decide without a test

EU(run)=0.8(10)+0.2(−30)=2.\mathrm{EU}(\text{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.\mathrm{EU}(\text{test then decide})=0.8(10)+0.2(0)=8.

The information is worth 8−2=68-2=\mathbf6 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.
Decisions above states, utilities below; later decisions are still pending.
At d1d_1, average the uncertain x2x_2. Once x2x_2 is known, choose d2d_2. 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 hth_t contain the observed history and define the best remaining value by

Vt(ht)=max⁡atE[rt+1+Vt+1(ht+1)∣ht,at],VT=0.V_t(h_t)=\max_{a_t}\mathbb E\big[r_{t+1}+V_{t+1}(h_{t+1})\mid h_t,a_t\big],\qquad V_T=0.

Fully observed Markov state

If sts_t contains all information relevant to the next transition and reward, replace the history with sts_t. 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)b_t(s)=P(s_t=s\mid h_t) 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⁡\sum \max \sum \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.
CLOSINGLecture 3

Where we are — the graph, and the seed

Model-based Data-driven
Static, single optimisation (Lec 1 ✓) Bayesian statistics (Lec 2 ✓) → Bayesian networks (Lec 3 ✓) → Lec 4

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 arg max⁡aEU\argmax_a \mathrm{EU} 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

Role Read or revisit Question to answer
Core Koller & Friedman, Probabilistic Graphical Models (2009): selected sections on Bayesian networks and inference 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)P(B\mid d^1,c^1) on p(B,S,E,D,C)=p(B)p(S)p(E∣B,S)p(D∣E)p(C∣E)p(B,S,E,D,C)=p(B)p(S)p(E\mid B,S)p(D\mid E)p(C\mid 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)T_1(B)\;T_2(S)\;T_3(E,B,S)\;T_4(D,E)\;T_5(C,E)
  1. Insert the evidence. Fix D=d1D=d^1 and C=c1C=c^1, which reduces T4T_4 and T5T_5 to factors over EE alone: T6(E)=T4(d1,E)T_6(E) = T_4(d^1,E), T7(E)=T5(c1,E)T_7(E)=T_5(c^1,E).
  2. Eliminate EE. Multiply every factor mentioning EE and sum it out: T8(B,S)=∑eT3(e,B,S) T6(e) T7(e)T_8(B,S) = \sum_e T_3(e,B,S)\,T_6(e)\,T_7(e).
  3. Eliminate SS. T9(B)=∑sT2(s) T8(B,s)T_9(B) = \sum_s T_2(s)\,T_8(B,s).
  4. Combine and normalise. P(B∣d1,c1)∝T1(B) T9(B)P(B\mid d^1,c^1) \propto T_1(B)\,T_9(B).

Cost. Each elimination creates an intermediate factor whose size is 2k2^{k} where kk 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)\prod P(x_i\mid\mathrm{pa}_i) 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→DC \to D with p(c1)=0.001p(c^1)=0.001, p(d1∣c1)=0.999p(d^1\mid c^1)=0.999, p(d1∣c0)=0.001p(d^1\mid c^0)=0.001, so that exactly p(c1∣d1)=0.999×0.0010.999×0.001+0.001×0.999=0.5p(c^1\mid d^1) = \frac{0.999 \times 0.001}{0.999\times 0.001 + 0.001\times 0.999} = 0.5. A 1,000-draw run has probability 0.9991000≈0.3680.999^{1000}\approx0.368 of never proposing c1c^1, 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 XX with a Bayesian network, a decision DD, a utility U(D,X)U(D,X). Given evidence ee,

EU(d∣e)=∑xp(x∣d,e) U(d,x),d∗=arg max⁡dEU(d∣e),MEU(e)=max⁡dEU(d∣e)\mathrm{EU}(d\mid e) = \sum_x p(x\mid d, e)\,U(d,x), \qquad d^{*} = \argmax_d \mathrm{EU}(d\mid e), \qquad \mathrm{MEU}(e) = \max_d \mathrm{EU}(d\mid e)

Many decisions. With the partial ordering X0≺D1≺⋯≺Dn≺Xn\mathcal{X}_0 \prec D_1 \prec \cdots \prec D_n \prec \mathcal{X}_n, the value of the first decision is

U(d1∣x0)=∑X1max⁡D2⋯∑Xn−1max⁡Dn∑Xn ∏i∈Lp(xi∣pa(xi)) ∑j∈TUj(pa(uj))U(d_1\mid x_0) = \sum_{\mathcal{X}_1}\max_{D_2}\cdots\sum_{\mathcal{X}_{n-1}}\max_{D_n}\sum_{\mathcal{X}_n}\ \prod_{i\in\mathcal{L}} p\big(x_i\mid \mathrm{pa}(x_i)\big)\ \sum_{j\in\mathcal{T}} U_j\big(\mathrm{pa}(u_j)\big)

with L\mathcal{L} the chance variables and T\mathcal{T} the utility variables.

The translation. Let each decision move a state, p(xt+1∣xt,dt)p(x_{t+1}\mid x_t,d_t); let utility accumulate as a per-step reward, ∑tu(xt)\sum_t u(x_t). Then MEU\mathrm{MEU} becomes the value function V∗V^{*}, the alternating ∑max⁡\sum\max becomes the dynamic-programming recursion, and arg max⁡dEU\argmax_d \mathrm{EU} becomes the Bellman optimality operator. Lecture 7 adds a discount factor γ\gamma and an infinite horizon; Lecture 8 removes pp 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.
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+ηta_t=a_{t-1}+\eta_t, xt=ht⊤at+ϵtx_t=h_t^\top a_t+\epsilon_t infer slowly changing coefficients as hidden states
Innovation variance: ARCH σt2=ω+∑iαiϵt−i2\sigma_t^2=\omega+\sum_i\alpha_i\epsilon_{t-i}^2 recent large residuals predict more variability
Innovation variance: GARCH σt2=ω+∑iαiϵt−i2+∑jβjσt−j2\sigma_t^2=\omega+\sum_i\alpha_i\epsilon_{t-i}^2+\sum_j\beta_j\sigma_{t-j}^2 past variance also persists

Use ω>0\omega>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.
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 span WW (continuous), military type MM (binary), radar cross section CC (continuous), and detection DD (binary).

p(w,m,c,d)=p(w) p(m) p(c∣w,m) p(d∣c).p(w,m,c,d)=p(w)\,p(m)\,p(c\mid w,m)\,p(d\mid c).
Node A possible local model Meaning
WW N(μW,σW2)\mathcal N(\mu_W,\sigma_W^2) distribution of wing spans
MM Bernoulli probability θ\theta frequency of the aircraft type
C∣W,M=mC\mid W,M=m N(amW+bm,σm2)\mathcal N(a_mW+b_m,\sigma_m^2) each type has its own regression
D∣CD\mid C P(D=1∣C)=1/(1+e−(C−c0)/b)P(D=1\mid C)=1/(1+e^{-(C-c_0)/b}), b>0b>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 graph stays fixed while the highlighted local model changes.
The highlighted root WW 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 graph stays fixed while the highlighted local model changes.
The highlighted root MM 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 graph stays fixed while the highlighted local model changes.
The highlighted CC 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 graph stays fixed while the highlighted local model changes.
The highlighted DD is binary. Its probability changes smoothly with continuous radar cross section CC.

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 GG as well as its parameters θ\theta:

P(G∣D)∝P(G)∫p(D∣θ,G)p(θ∣G) dθ⏟p(D∣G), the model evidence.P(G\mid D)\propto P(G)\underbrace{\int p(D\mid\theta,G)p(\theta\mid G)\,d\theta}_{p(D\mid G)\text{, the model evidence}}.
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.
Lagged observations point to the next value.

An AR(LL) model uses the last LL values as regression features:

xt=a⊤ht+ϵt,ht=[xt−1,…,xt−L]⊤,ϵt∼N(0,σ2).x_t=a^\top h_t+\epsilon_t,\quad h_t=[x_{t-1},\ldots,x_{t-L}]^\top,\quad\epsilon_t\sim\mathcal N(0,\sigma^2).

Lecture 2's regression now specifies a transition model. Gaussian MLE still minimises ∑t(xt−a⊤ht)2\sum_t(x_t-a^\top h_t)^2.

AR(2) is generally not first-order Markov in xtx_t. It is first-order in [xt,xt−1][x_t,x_{t-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

Keys

→ / space
next reveal, then next slide
←
back
↑ ↓
skip a whole slide
R
reset this slide's widgets and quizzes
M
slide index
P
print → save as PDF (1280×720)
F
fullscreen