genome evolution: a sequence-centric approach lecture 6: belief propagation

23
Genome evolution: a sequence-centric approach Lecture 6: Belief propagation

Post on 21-Dec-2015

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Genome evolution: a sequence-centric approach Lecture 6: Belief propagation

Genome evolution: a sequence-centric approach

Lecture 6: Belief propagation

Page 2: Genome evolution: a sequence-centric approach Lecture 6: Belief propagation

Probabilistic models

Inference

Parameter estimation

Genome structure

Mutations

Population

Inferring Selection

(Probability, Calculus/Matrix theory, some graph theory, some statistics)

Simple Tree ModelsHMMs and variantsPhyloHMM,DBNContext-aware MMFactor Graphs

DPSamplingVariational apx.

EMGeneralized EM (optimize free energy)

Refs: HMM,simple tree: DurbinBasic BNs: HeckermanSampling: Mackey bookVariational: Jojic et al. paperLBP: Yedidia,Freeman, Weiss

Page 3: Genome evolution: a sequence-centric approach Lecture 6: Belief propagation

Simple Tree: Inference as message passing

s

s

s s

s

s

sYou are P(H|our data)

You are P(H|our data)

I am P(H|all data)

DATA

Page 4: Genome evolution: a sequence-centric approach Lecture 6: Belief propagation

Belief propagation in a factor graph

)(1

)|( aaa xZ

xP

• Remember, a factor graph is defined given a set of random variables (use indices i,j,k.) and a set of factors on groups of variables (use indices a,b..)

)( iia xm

• Think of messages as transmitting beliefs:

a->i : given my other inputs variables, and ignoring your message, you are x

i->a : given my other inputs factors and my potential, and ignoring your message, you are x

• xa refers to an assignment of values to the inputs of the factor a

• Z is the partition function (which is hard to compute)

• The BP algorithm is constructed by computing and updating messages:

• Messages from factors to variables:

• Messages from variables to factors: )( iai xm

(any value attainable by xi)->real values

Page 5: Genome evolution: a sequence-centric approach Lecture 6: Belief propagation

Messages update rules:

)()(\)(

iicaiNc

iai xmxm

ia xx

jajiaNj

aaiia xmxxm )()()(\)(

a

iiaN \)(

a

i aiN \)(

• Messages from variables to factors:

• Messages from factors to variables:

Page 6: Genome evolution: a sequence-centric approach Lecture 6: Belief propagation

The algorithm proceeds by updating messages:

• Define the beliefs as approximating single variables posterios (p(hi|s)):

)()()(

iiaiNa

ii xmxb

Algorithm:

Initialize all messages to uniformIterate until no message change:

Update factors to variables messagesUpdate variables to factors messages

• Why this is different than the mean field algorithm?

)()( ii hqhq

Page 7: Genome evolution: a sequence-centric approach Lecture 6: Belief propagation

Beliefs on factor inputs

• This is far from mean field, since for example

)()(

)()()()(

\)()(

)()(

jjcajNcaNj

a

jjaNj

jajaNj

aaa

xmx

xbxmxxb

ia xxjjc

ajNcaNjaiiiid

iNdxmxxbxm )()()()(

\)()()(

ia xxjjc

ajNciaNjaiia xmxxm )()()(

\)(\)(

• The update rules can be viewed as derived from the:

1.requirement on the variables beliefs (bi)

2.requirement on the factor beliefs (ba)

3.Marginalization requirement:

Here’s how:

ia xx

aaii xbxb\

)()(

)()()(

iiaiNa

ii xmxb

Page 8: Genome evolution: a sequence-centric approach Lecture 6: Belief propagation

BP on Tree = Up-Down

s4 s3

h2

h3e

s2 s1

h1

b a

c

d

)|Pr()|Pr()( 12111hshsxup ih

111)( 1 hbhach mmhm

)()()(

)()()(

2\

1

1\

1

11

11

smxhm

smxhm

bshx

bhb

ashx

aha

ib

ia

32

32

1

,313232 )|Pr()|Pr()()(

)(

hhhh

ih

hhhhhdownhup

xdown

3 2

2

3

33

1

31

)(),()(),(

)()(),(

)()()(

323313

3313

\31

h hehedc

hhehdc

hxchcchc

hmhhhhh

hmhmhh

hmxhmc

2 1

3

Page 9: Genome evolution: a sequence-centric approach Lecture 6: Belief propagation

Loopy BP is not guaranteed to converge

X Y

Y

x

01

10

Y

x

01

10

1 1

0 0

This is not a hypothetical scenario – it frequently happens when there is too much symmetryFor example, most mutational effects are double stranded and so symmetric which can result

in loops.

Page 10: Genome evolution: a sequence-centric approach Lecture 6: Belief propagation

The Bethe Free Energy

H. Bethe

• LBP was introduced in several domains (BNs, Coding), and is consider very practical in many cases.

• ..but unlike the variational approaches we studied before, it is not clear how it approximate the likelihood/partition function, even when it converges..

hh

hqhqshphqF )(log)()|,(log)( • Compare to the variational free energy:

Theorem: beliefs are LBP fixed points if and only if they are locally optimal for the Bethe free energy

iiii

aaabethe

aaabethe

BetheBetheBethe

xbxbdxbxbH

xxbU

HUF

)(log)()1()(log)(

)(log)(

• In the early 2000, Yedidia, Freeman and Weiss discovered a connection between the LBP algorithm and the Bethe free energy developed by Hans Bethe to approximate the free energy in crystal field theory back in the 40’s/50’s.

Page 11: Genome evolution: a sequence-centric approach Lecture 6: Belief propagation

Generalization: Regions-based free energy

RR Aa

RXi

R caci 11

• Start with a factor graph (X,A)

• Introduce regions (XR,AR) and multipliers cR

• We require that:

• We will work with valid regions graphs:

)()()(

)(log)()(

)()()(

)(log)(

RRRRRR

xRRRRRR

xRRRRR

AaaRR

bHbUbF

xbxbbH

xExbbU

xxE

R

R

R

RR XaNAa )(

Region-based average energy

Region average energy

Region Entropy

Region Free energy

})({})({})({

)(})({

)(})({

R

R

R

RRRRR

RRRRR

RRRR

bHbUbF

bHcbH

bUcbU

Region-based entropy

Region-based free energy

Page 12: Genome evolution: a sequence-centric approach Lecture 6: Belief propagation

Bethe regions are the factors neighbors set and single variables regions:

a

c

b

111 ccbac ccc

We compensate for the multiple counting of variables using the multiplicity constant

We can add larger regions

As long as we update the multipliers:

11 iia dcc

Ra

Rac

Rbc

RR

RR cc'

'1

Page 13: Genome evolution: a sequence-centric approach Lecture 6: Belief propagation

Multipliers compensate on average, not on entropy

Claim: If the regions’ beliefs are exact then the average region-based energy is exact.

a x

aaaa

c

R x RaaaRRR

RRRRRR

a

RaR

R

xxbxxbcbUcbU )(log)()(log)()(})({)1(

We cannot guarantee much on the region-based entropy:

Claim: the region-based entropy is exact when the model is a uniform distributionProof: exercise. This means that the entropy count the correct number of degrees of

freedom – e.g. for binary variables, H=Nlog2

Definition: a region based free energy approximation is said to be max-ent normal if its region-based entropy is maximized when the beliefs are uniform.

An non max-ent approximation can minimize the region free energy by selecting erroneously high entropy beliefs!

Page 14: Genome evolution: a sequence-centric approach Lecture 6: Belief propagation

Bethe’s region are max-ent normal

Claim: The Bethe regions gives a max-ent normal approximation (i.e. it maximize the region-based entropy on the uniform distribution)

a x aNi xiiiiaaaa

i xiiiiBethe

a ii

xbxbxbxbxbxbH)(

)(log)()(ln)()(log)(

Entropy Information

(maximal on uniform) (0 and minimal on uniform)

Page 15: Genome evolution: a sequence-centric approach Lecture 6: Belief propagation

Start with a complete graph and binary factors

Add all variable triplets, pairs and singleton as regions

Generate multipliers:triplets = 1 (20 overall)pairs = -3 (15 overall)singletons = 6 (6 overall) ( guarantee consistency)

Example: A Non max-ent approximation

Look at the consistent beliefs:

The Region entropy (for any region) = ln2. The total region entropy is:

otherwise

xxxxxxb

otherwise

xxxxbxb kji

kjiji

jii 0

2/1),,(

0

2/1),(;5.0)0(

2ln112ln362ln452ln20 R

RRR HcH

We claimed before the entropy of the uniform distribution will be exact: 6ln2

RR

RR cc'

'1

Page 16: Genome evolution: a sequence-centric approach Lecture 6: Belief propagation

We basically solve a variational problem:

While enforcing constraints on the regions’ beliefs:

Inference as minimization of region-based free energy

})({min RR bF

1)( Rx

RR xb

)()( ''\ '

RRxx

RR xbxbRR

Unlike the structured variational approximation we discussed before, and although the beliefs are (pairwise) compatible, we can have cases with locally optimal beliefs that are not representing a true global posterior distribution

C

BA

Y

x

4.01.0

1.04.0

1.04.0

4.01.0,

4.01.0

1.04.0CBA bbb

Y

x

1.04.0

4.01.0

Optimal region beliefs are identical to the factors:

5.0

5.0ib

Y

x

4.01.0

1.04.0

This is pairwise consistent, but cannot be the result of any joint distribution on the three vars

(we have a negative feedback loop here)

Page 17: Genome evolution: a sequence-centric approach Lecture 6: Belief propagation

Claim: When it converges, LBP finds a minimum of the Bethe free energy.

Proof idea: we have an optimization problem (minimum energy) with constraints (beliefs are consistent and adds up to 1). We write down a Lagrangian that expresses both minimization goal and constraints, and show that it is minimized when the LBP update rules are holding.

Inference as minimization of region-based free energy

i iNa x xxaaiiiai

i xiii

a xaaaBethe

i ia

ia

xbxbx

xbxbFL

)( \

)]()()[(

1)(1)(

Important technical point: we shall assume that in the fixed point all beliefs are non zero. This can be shown to hold if all factors are “soft” (do not contain zero values for any assignment).

Page 18: Genome evolution: a sequence-centric approach Lecture 6: Belief propagation

The Bethe Lagrangian

i iNa x xxaaiiiai

i xiii

a xaaaBethe

i ia

ia

xbxbx

xbxbFL

)( \

)]()()[(

1)(1)(

i x

iiiiia x

aaaaa x

aaaaBethe

iaa

xbxbdxbxbxxbF )(log)()1()(log)()(log)(

i iNa x xxaaiiiai

i xiii

a xaaa

i ia

i

a

xbxbx

xb

xb

)( \

)]()()[(

1)(

1)(

Large region beliefs are normalized

Variable region beliefs are normalized

Marginalization

Page 19: Genome evolution: a sequence-centric approach Lecture 6: Belief propagation

The Bethe lagrangian

Take the derivatives with respect to each ba and bi:

))(1exp()()(

)(1)(log)(log)(

)(

)(

aNiiaiaaaaa

aNiiaiaaaaa

aia

xxxb

xxbxxb

L

i iNa x xxaaiiiai

i xiii

a xaaaBethe

i ia

ia

xbxbx

xbxbFL

)( \

)]()()[(

1)(1)(

i x

iiiiia x

aaaaa x

aaaaBethe

iaa

xbxbdxbxbxxbF )(log)()1()(log)()(log)(

)))((1

11exp()(

)()1)()(log1()(

)(

)(

aNiiaii

iii

iNaiaiiiii

ii

xd

xb

xxbdxb

L

Page 20: Genome evolution: a sequence-centric approach Lecture 6: Belief propagation

Bethe minimum are LBP fixed points

))(exp()())(1exp()()()(

)(iai

aNia

aNiiaiaaaaa xxxxxb

)1

)(exp()))((

1

11exp()(

)()(

i

iai

iNaaNiiaii

iii d

xx

dxb

)(log)(log)(\)(

iicaiNc

iaiiai xmxmx

So here are the conditions:

And we can solve them if:

)()()(\)()(

iicaiNcaNi

aaa xmxxb

)()(1

1)(

)(\)()(iia

iNaiic

aiNci

iNaii xmxm

dxb

Giving us:

We saw before these conditions, with the marginalization constraint, are generating the update rules! So L minimum -> LBP fixed point is proven.

The other direction quite direct – see Exercise

LBP is in fact computing the lagrange multipliers – a very powerful observation

Page 21: Genome evolution: a sequence-centric approach Lecture 6: Belief propagation

Generalizing LBP for region graphs

)()()()( '})(\{)P(')()P(

DDPRRDDPRDD

RRPRP

aaAa

RR xmxmxxbR

Parent-to-child beliefs:

A region graph is graph on subsets of nodes in the factor graph, with valid multipliers (as defined above)

RD(R) – Decedents of R

P(R)

RR Aa

RXi

R caci 11

• regions (XR,AR) and multipliers cR

• We require that:

• We will work with valid regions graphs:

RR XaNAa )(

RR

RR cc'

'1

P(D(R))\D(R)P(R) – Parents of R

D(R)

Page 22: Genome evolution: a sequence-centric approach Lecture 6: Belief propagation

Generalizing LBP for region graphs

)()()()( '})(\{)P(')()P(

DDPRRDDPRDD

RRPRP

aaAa

RR xmxmxxbR

Parent-to-child algorithm:

RP

RP

x JJIRPDJI

JJIRPNJIaFaRRP xm

xmxxm

\

\

)(

)()()(

),(),(

),(),(

I

J

D(P)+P

Not D(P)+P

D(R) – Decedents of R

P(R) – Parents of R

P

RD(R)+R

IJ

D(P)+PP

RD(R)+R

N(I,J) = I not in D(P)+P J in D(P)+P but not D(R)+R

D(I,J) = I in D(P)+P but not D(R)+R J in D(R)+R

Page 23: Genome evolution: a sequence-centric approach Lecture 6: Belief propagation

GLBP in practice

LBP is very attractive for users: really simple to implement, very fast

LBP performance is limited by the size of region assignments Xa which can grow rapidly with the factor’s degrees or the size of large regions

GLBP will be powerful when large regions can capture significant dependencies that are not captured by individual factors – think small positive loop or other symmetric effects

LBP messages can be computed synchronously (factors->variables->factors…), other scheduling options may boost up performance considerably

LBP is just one (quite indirect) way by which Bethe energies can be minimized. Other approaches are possible – which can be guaranteed to converge

The Bethe/Region energy minimization can be further constraint to force beliefs are realizable. This gives rise to the concept of Wainwright-Jordan marginal polytope and convex algorithms on it.