Bayesian Parameter Estimation in Bayesian...

25
Machine Learning Srihari 1 Bayesian Parameter Estimation in Bayesian Networks Sargur Srihari [email protected]

Transcript of Bayesian Parameter Estimation in Bayesian...

Page 1: Bayesian Parameter Estimation in Bayesian Networkssrihari/CSE674/Chap17/17.2-BayesianBNParams.pdfMachine Learning Inconsistency of K2 Prior Srihari • For every multinomial parameter

Machine Learning Srihari

1

Bayesian Parameter Estimation in Bayesian Networks

Sargur Srihari [email protected]

Page 2: Bayesian Parameter Estimation in Bayesian Networkssrihari/CSE674/Chap17/17.2-BayesianBNParams.pdfMachine Learning Inconsistency of K2 Prior Srihari • For every multinomial parameter

Machine Learning Srihari

Topics

2

•  Bayesian network where parameters are variables

•  Global parameter independence – Leads to global decomposition

•  How to choose priors for Bayesian learning – K2 Prior – BDe Prior

•  Comparison of Bayesian and MLE in ICU example

Page 3: Bayesian Parameter Estimation in Bayesian Networkssrihari/CSE674/Chap17/17.2-BayesianBNParams.pdfMachine Learning Inconsistency of K2 Prior Srihari • For every multinomial parameter

Machine Learning Srihari

Fully Bayesian Approach

•  In the full Bayesian approach to BN learning: – Parameters are considered to be random variables

•  Need a joint distribution over unknown parameters θ and data instances D

•  This joint distribution itself can be represented as a Bayesian network –  instances and parameters of variables

3

Page 4: Bayesian Parameter Estimation in Bayesian Networkssrihari/CSE674/Chap17/17.2-BayesianBNParams.pdfMachine Learning Inconsistency of K2 Prior Srihari • For every multinomial parameter

Machine Learning Srihari A simple example with 2 variables •  Consider the network XàY •  Training data D={X[m],Y[m]} for m=1,..M •  Unknown Parameter vectors θX and θY|X •  Meta network (BN of BN) for describing

learning set-up

4

X

Y

Data m

(a) (b)

Y [2]Y [1] Y [M]

qY |X

. . .

X [2]X [1] X [M]

qX

qX . . .

qY |X

Plate Model Ground Bayesian Network

Parameters for marginal X

Parameters for conditional Y/X

Page 5: Bayesian Parameter Estimation in Bayesian Networkssrihari/CSE674/Chap17/17.2-BayesianBNParams.pdfMachine Learning Inconsistency of K2 Prior Srihari • For every multinomial parameter

Machine Learning Srihari

Global Parameter Independence •  If G is a Bayesian network with parameters

•  Global Parameter independence assumption: – Priors for individual parameters tells us nothing

about another – A prior P(θ) satisfies global independence if

•  Network with global parameter independence:

5

X

Y

Data m

(a) (b)

Y [2]Y [1] Y [M]

qY |X

. . .

X [2]X [1] X [M]

qX

qX . . .

qY |X

θ = (θX1 |PaX 1,..,θXn |PaXn

)

P(θ) = P(θX i |PaX i)

i∏

Page 6: Bayesian Parameter Estimation in Bayesian Networkssrihari/CSE674/Chap17/17.2-BayesianBNParams.pdfMachine Learning Inconsistency of K2 Prior Srihari • For every multinomial parameter

Machine Learning Srihari

Caution on Parameter Independence

6

•  Although we assume global parameter independence it should be considered with care

•  Extension of student example – Student takes multiple classes – We want to learn distribution of grade given

intelligence and difficulty – Same instructor for two courses may make

parameters dependent

Page 7: Bayesian Parameter Estimation in Bayesian Networkssrihari/CSE674/Chap17/17.2-BayesianBNParams.pdfMachine Learning Inconsistency of K2 Prior Srihari • For every multinomial parameter

Machine Learning Srihari

Global Decomposition

7

•  Important conclusion if we assume global parameter independence

•  E.g., if x[m] and y[m] are observed for all m, then θX and θY|X are d-separated

•  Practical ramification

– Given data set D, we can determine the posterior over θX independently of the posterior over θY|X

X

Y

Data m

(a) (b)

Y [2]Y [1] Y [M]

qY |X

. . .

X [2]X [1] X [M]

qX

qX . . .

qY |X

Page 8: Bayesian Parameter Estimation in Bayesian Networkssrihari/CSE674/Chap17/17.2-BayesianBNParams.pdfMachine Learning Inconsistency of K2 Prior Srihari • For every multinomial parameter

Machine Learning Srihari

General Networks

8

Page 9: Bayesian Parameter Estimation in Bayesian Networkssrihari/CSE674/Chap17/17.2-BayesianBNParams.pdfMachine Learning Inconsistency of K2 Prior Srihari • For every multinomial parameter

Machine Learning Srihari

Prediction Problem

9

Page 10: Bayesian Parameter Estimation in Bayesian Networkssrihari/CSE674/Chap17/17.2-BayesianBNParams.pdfMachine Learning Inconsistency of K2 Prior Srihari • For every multinomial parameter

Machine Learning Srihari Priors for BN Learning

•  Each node X in a BN has a set of multinomial distributions θXi|paXi , one for each instantiation paXi of Xi’s parents PaXi

•  Each of these parameters has a separate Dirichlet prior governed by hyperparameters

– Where Ki is the number of values of Xi

•  Prediction: •  How to determine α and αj s? 10

αXi|paXi

= αxi

1|paXi

,..,αxi

Ki |paXi

⎝⎜⎜⎜

⎠⎟⎟⎟⎟

θ ~ Dirichlet(α1,..,α k ) if P(θ)∝k∏ θk

αk −1

α = α jj∑Note that α is the total no of imaginary samples which does not sum to 1

α are pseudocounts

P(x[M +1] = xk |D) = M[k]+α k

M +α

Page 11: Bayesian Parameter Estimation in Bayesian Networkssrihari/CSE674/Chap17/17.2-BayesianBNParams.pdfMachine Learning Inconsistency of K2 Prior Srihari • For every multinomial parameter

Machine Learning Srihari

K2 Prior

•  In a software system called K2 •  Use a fixed prior

– For all hyper-parameters in the network •  Has consequences that are conceptually

unsatisfying

11

α

xij |paXi

= 1 Add 1 to every cell in CPD

Page 12: Bayesian Parameter Estimation in Bayesian Networkssrihari/CSE674/Chap17/17.2-BayesianBNParams.pdfMachine Learning Inconsistency of K2 Prior Srihari • For every multinomial parameter

Machine Learning Srihari Inconsistency of K2 Prior

•  For every multinomial parameter – a fixed Dirichlet D(α,.., α)

•  Typically α=1, called K2 prior

•  K2 prior is inconsistent – Ex 1: Y is binary valued y0,y1 with no parents

•  If we take Dirichlet(1,1) for θY our imaginary sample size for Y is 2

– Ex 2: Introduce parent X with four values x0-x3 to get XàY

Y is still binary valued y0,y1 •  If Dirichlet(1,1) is prior for all parameters θY|xi

•  Imaginary sample size for Y is 8, two for each context xi

– No. of imaginary samples we have seen for a event should not depend on structure chosen

X

Y

x0 x1 x2 x3

y0 +1 +1

+1 +1

y1 +1 +1 +1 +1

Y

y0 y1

+1 +1

Page 13: Bayesian Parameter Estimation in Bayesian Networkssrihari/CSE674/Chap17/17.2-BayesianBNParams.pdfMachine Learning Inconsistency of K2 Prior Srihari • For every multinomial parameter

Machine Learning Srihari

Common Approach •  Hyperparameter αxk is an imaginary count of

prior experience •  Have a data set D’ of prior examples •  We set

– where α [xi, paXi] is the no. of times Xi=xi and PaXi=paXi in D’

•  Count the parent-child combinations in imaginary data

•  Equivalent to MLE with combined D and D’•  Requires storing a large set of pseudoinstances

– A sample for every parent-child combination 13

αxi |paXi =α xi, paXi!" #$

Page 14: Bayesian Parameter Estimation in Bayesian Networkssrihari/CSE674/Chap17/17.2-BayesianBNParams.pdfMachine Learning Inconsistency of K2 Prior Srihari • For every multinomial parameter

Machine Learning Srihari

Common Approach Example •  Generalizes K2 •  Example: – Y is binary valued y0,y1

– Parent X with four values x0-x3 to get XàY

•  α [yi, paYi] •  Samples:

14

X

Y

y0 y1

2 2

x0 x1 x2 x3

y0 2 2

2 2

y1 2 2 2 2

Page 15: Bayesian Parameter Estimation in Bayesian Networkssrihari/CSE674/Chap17/17.2-BayesianBNParams.pdfMachine Learning Inconsistency of K2 Prior Srihari • For every multinomial parameter

Machine Learning Srihari

BDe (Bayesian Dirichlet equivalent) prior

•  Store size of imaginary data set α and P’[X1,.., Xn] of frequencies of events

– probability of every possible ξ •  Set the parameters as follows:

– This will divide data set proportionately •  Apply this to XàY problem

– No of imaginary samples for different choices of parents will be identical 15

αxi|paXi

= α i P '(xi,pa

Xi)

αy= αiP '(y)= α •P '(y,xi

xi∑ )= α

y|xi

xi∑

X

Y

Page 16: Bayesian Parameter Estimation in Bayesian Networkssrihari/CSE674/Chap17/17.2-BayesianBNParams.pdfMachine Learning Inconsistency of K2 Prior Srihari • For every multinomial parameter

Machine Learning Srihari

How do we represent P’ for BDe?

•  Use a Bayesian network so we can efficiently infer the quantities P’(xi , paXi)

•  When we have no prior knowledge we can set P’ to be uniform –  Implies an empty BN with uniform

distributions for each variable •  Network structure is used only to provide

parameters’ priors not to guide structure search

16

Page 17: Bayesian Parameter Estimation in Bayesian Networkssrihari/CSE674/Chap17/17.2-BayesianBNParams.pdfMachine Learning Inconsistency of K2 Prior Srihari • For every multinomial parameter

Machine Learning Srihari

BDe satisfies Score Equivalence •  BDe has a property useful in structure learning

– Bayesian score

– Score of a graph with Dirichlet Prior

– Score decomposability •  Score equivalence

– Networks with same Bde score are I-equivalent 17

P(G |D) = P(D |G)P(G)P(D)

scoreB(G :D) = logP(D |G)+ logP(G)

scoreBIC (G :D) = ℓ(θG :D)−

logM2

Dim[G]

Page 18: Bayesian Parameter Estimation in Bayesian Networkssrihari/CSE674/Chap17/17.2-BayesianBNParams.pdfMachine Learning Inconsistency of K2 Prior Srihari • For every multinomial parameter

Machine Learning Srihari

Application to ICU monitoring •  Decision support system

(medical diagnostics) •  Monitoring severely ill

patients in ICU •  Goal is to calculate

probabilities for a differential diagnosis based on available evidence

18 In differential diagnosis there are multiple alternatives which are systematically eliminated

Page 19: Bayesian Parameter Estimation in Bayesian Networkssrihari/CSE674/Chap17/17.2-BayesianBNParams.pdfMachine Learning Inconsistency of K2 Prior Srihari • For every multinomial parameter

Machine Learning Srihari

Variables in ICU Alarm

•  Medical knowledge encoded as 37 variables: – 8 diagnoses (at top level, no parents) – 16 findings – 13 intermediate variables

•  Some top-level variables: – Anaphylaxis (severe allergic reaction) – Hypovolemia (shock of decreased blood volume) – Kinked Tube – Disconnect – Left Ventricle Failure

19

Page 20: Bayesian Parameter Estimation in Bayesian Networkssrihari/CSE674/Chap17/17.2-BayesianBNParams.pdfMachine Learning Inconsistency of K2 Prior Srihari • For every multinomial parameter

Machine Learning Srihari

Bayesian Network for ICU-Alarm

20

Hand-constructed by experts for monitoring patients in an Intensive Care Unit Benchmark for Bayesian Network Learning (Parameter Estimation)

Page 21: Bayesian Parameter Estimation in Bayesian Networkssrihari/CSE674/Chap17/17.2-BayesianBNParams.pdfMachine Learning Inconsistency of K2 Prior Srihari • For every multinomial parameter

Machine Learning Srihari

ICU alarm network

21

ALARM network: A Logical Alarm Reduction Mechanism Marginal probabilities of each variable are shown

Page 22: Bayesian Parameter Estimation in Bayesian Networkssrihari/CSE674/Chap17/17.2-BayesianBNParams.pdfMachine Learning Inconsistency of K2 Prior Srihari • For every multinomial parameter

Machine Learning Srihari

Contingency Tables between Dependent Variables

22

A contingency tables usually shows dependency between a pair of variables These show marginal probabilities of each variable

Page 23: Bayesian Parameter Estimation in Bayesian Networkssrihari/CSE674/Chap17/17.2-BayesianBNParams.pdfMachine Learning Inconsistency of K2 Prior Srihari • For every multinomial parameter

Machine Learning Srihari

Parameters for ICU Alarm

23

•  Network Parameters –  37 nodes with table CPDs –  504 parameters (instead of 254)

•  Evaluate ability of parameter estimation method – To reconstruct network parameters from data

•  Inputs for parameter estimation – Training samples

•  Obtained by sampling from specified network

– Network structure

Page 24: Bayesian Parameter Estimation in Bayesian Networkssrihari/CSE674/Chap17/17.2-BayesianBNParams.pdfMachine Learning Inconsistency of K2 Prior Srihari • For every multinomial parameter

Machine Learning Srihari

Learning curve for ICU alarm

•  Relative entropy to true model

24

Page 25: Bayesian Parameter Estimation in Bayesian Networkssrihari/CSE674/Chap17/17.2-BayesianBNParams.pdfMachine Learning Inconsistency of K2 Prior Srihari • For every multinomial parameter

Machine Learning Srihari

A Static Bayesian Network

25

For diagnosing why a car won't start, based on spark plugs, headlights, main fuse, etc.