BAYESIAN NETWORKS

Frans Coenen

Liverpool University

Department of Computer Science

January 2002

Version I

**** IN PREPARATION, APPLETS DO NOT WORK! ****

Contents:

  1. Introduction.
    1. Joint probability.
    2. Conditional probability.
  2. Example 1: Diverging connection.
    1. Instantiating B.
    2. Instantiating A.



1. INTRODUCTION

A bayesian network is a causal network comprising:

The variable and edges form a Directed Acyclic Graph (DAG), i.e. there are no "feed-back cycles" in the graph. The root nodes of this graph have unconditional probabilities associated with them.


1.1 Joint Probability

Equation 1

P(ai and bi) = P(ai) x P(bi)

where ai and bi are possible values for two variables A and B, and P(n) is the probability of value n being true (probability is expressed as a real number between 0.0 and 1.0.

Alternatively we can calculate the joint probability using:

Equation 2

p(ai and bi) = p(ai | bi) x p(bi)

Where p(ai | bi) is the conditional probability of the value ai existing if the value bi exists.


1.2 Conditional Probability

Equation 3

              p(bi | ai) x p(ai)
p(ai | bi) = --------------------
                    p(bi)




2. EXAMPLE 1: DIVERGING CONNECTION

In Figure 1 a network with a diverging connection is presented such that A causes both B and C.

Figure 1: Diverging connection

We will assume that each variable has two values i and j each with which has a probability associated with it. The variables might then be interpreted as follows:

Variable Interpretation
aiRail travel disruption
ajNo rail travel disruption
biTrevor late at work
bjTrevor not late at work
biPaul late at work
biPaul not late at work

We then attach probability tables to each node. In the case of A, the root node, this will be an unconditional probability table (P(A) = 1):

Variable P
ai0.7
aj0.3
Unconditional Probability table for Node A

Thus the probability of there being disruption on the railways is 0.7. We attach conditional probability tables to nodes B and C (P(B|A) and P(C|A)). That for B is given below (C will have identical values).

aiaj
bi0.8 0.1
bj0.2 0.9
Conditional Probability table for Node B

Note that the figures entered into these tables, for example that the probability of Trevor being late for work if there is disruption on the rail ways is 0.8 or that the probability that Trevor will be late for work if there is no disruption on the railways is 0.1 is subjective.

The joint probability table for p(A and B) is given below (again that for p(A and C) will have identical values). The values are calculated using Equation 2, fir example:

p(bn and an) = p(bn | an) x p(an)

Thus:

p(bi and ai) = p(bi | ai x p(ai) = 0.8 x 0.7 = 0.56
aiaj
bi0.8 x 0.7 = 0.56 0.1 x 0.3 = 0.03
bj0.2 x 0.7 = 0.14 0.9 x 0.3 = 0.22
p(B and A)

By marginalising A from p(B and A) we get p(B):

p(B) = p(C) = ((0.56+0.03),(0.14,0.27)) = (0.59,0.41) 

i.e.

p(B=bi) = p(C=ci) = 0.59
p(B=bj) = p(C=cj) = 0.41

Thus:

Variable P
ai0.70
aj0.30
bi0.59
bj0.41
ci0.59
cj0.41

i.e. the probability of Trevor or Paul being late for work is 0.59.


2.1 Instantiating B

Now supposing that we obtain evidence that bi is true, i.e. B = bi (Trevor is late for work); we say that node B has become instantiated. Knowledge of this now allows us to revise the probability table for node A. The revision is done by calculating the conditional probability of A given B = bi (p(A|B=bi)), using:

                p(B=bi|A) p(A)
p(A|B=bi) = ---------------------
                    p(B=bi)

We know that:

p(B=bi) = 0.59 (The probability of Trevor being late at work for what ever reason)
p(bi|ai) = 0.8 (The probability of Trevor being late at work due to disruption on the railways)
p(bi|aj) = 0.1 (The probability of Trevor being late at work for some other reason)
p(ai) = 0.7 (The probability of disruption on the railways)
p(ai) = 0.3 (The probability of no disruption on the railways)

Thus:

             (0.8,0.1) x (0.7,0.3)     (0.8 x 0.7,0.1 x 0.3)
p(A|B=bi) = ----------------------- = -----------------------
                      0.59                        0.59

                        (0.56,0.03)   
                     = ------------- = (0.95,0.05)
		           0.59  

The new probability table for Node A is now:

Variable P
ai0.95
aj0.05
Probability table for Node A

Note that the probability of there being disruption on the railways has increased as a result of node B being instantiated (i.e. knowledge that Trevor is late at work).

The new probability table for Node C must now be calculated using:

P(ci and ai) =  ci x ai
aiaj
bi0.8 x 0.95 = 0.760 0.1 x 0.05 = 0.005
bj0.2 x 0.95 = 0.190 0.9 x 0.05 = 0.045
p(B and A)

and

P(C) = (0.765,0.235)

Thus:

Variable P
ai0.950
aj0.050
bi1.000
bj0.000
ci0.765
cj0.235

The probability of Paul being late at work has increased to 0.765 from 0.59.


2.2 Instantiating A

If we now receive knowledge that there is no disruption on the railway (A = aj and P(aj)=1) this will have no effect on node B (we know that Trevor is late), however we must revise our probability table for C

aiaj
bi0.8 x 0.0 = 0.0 0.1 x 1.0 = 0.1
bj0.2 x 0.0 = 0.0 0.9 x 1.0 = 0.9
p(C and A)

Thus:

Variable P
ai0.000
aj1.000
bi1.000
bj0.000
ci0.100
cj0.900

3. REFERENCES

  1. Jensen, F.V.(1996). An Introduction to Bayesian Networks UCL Press, London.



Created and maintained by Frans Coenen. Last updated 01 February 2002