1 / 42

Genome evolution:

Genome evolution:. Lecture 9: Variational inference and Belief propagation. Expectation-Maximization. The free energy is exactly the likelihood when q is the posterior:. Log-likelihood to Free Energy. We have so far worked on computing the likelihood:.

Download Presentation

Genome evolution:

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Genome evolution: Lecture 9: Variational inference and Belief propagation

  2. Expectation-Maximization

  3. The free energy is exactly the likelihood when q is the posterior: Log-likelihood to Free Energy • We have so far worked on computing the likelihood: • Computing likelihood is hard. We can reformulate the problem by adding parameters and transforming it into an optimization problem. Given a trial function q, define the free energy of the model as: • Better: when q a distribution, the free energy bounds the likelihood: D(q || p(h|s)) Likelihood

  4. Energy?? What energy? • In statistical mechanics, a system at temperature T with states x and an energy function E(x) is characterized by Boltzman’s law: • Z is the partition function: • Given a model p(h,s|T) (a BN), we can define the energy using Boltzman’s law • If we think of P(h|s,q):

  5. Free Energy and Variational Free Energy • The Helmoholtz free energy is defined in physics as: • This free energy is important in statistical mechanics, but it is difficult to compute, as our probabilistic Z (= p(s)) • The variational transformation introduce trial functions q(h), and set the variational free energy (or Gibbs free energy) to: • The average energy is: • The variational entropy is: • And as before:

  6. Maxmizing U? Maxmizing H? Solving the variational optimization problem Focus on max configurations Spread out the distribution • So instead of computing p(s), we can search for q that optimizes the free energy • This is still hard as before, but we can simplify the problem by restricting q • (this is where the additional degrees of freedom become important)

  7. Maxmizing U? Maxmizing H? Simplest variational approximation: Mean Field Focus on max configurations Spread out the distribution • Let’s assume complete independence among r.v.’s posteriors: • Under this assumption we can try optimizing the qi – (looking for minimal energy!)

  8. Mean Field Inference • We optimize iteratively: • Select i (sequentially, or using any method) • Optimize qi to minimize FMF(q1,..,qi,…,qn) while fixing all other qs • Terminate when FMF cannot be improved further • Remember: FMF always bound the likelihood • qi optimization can usually be done efficiently

  9. Mean field for a simple-tree model Just for illustration, since we know how solve this one exactly: We select a node and optimize its qi while making sure it is a distribution: The energy decomposes, and only few terms are affected: To ease notation, assume the left (l) and right (r) children are hidden

  10. Mean field for a simple-tree model Just for illustration, since we know how solve this one exactly: We select a node and optimize its qi while making sure it is a distribution:

  11. Mean field for a phylo-hmm model Now we don’t know how to solve this exactly, but MF is still simple: hj-1pai hjpai hjpai hj-1i hji hj+1i hj+1l hj-1r hjl hj-1r hjr hj+1r

  12. Mean field for a phylo-hmm model Now we don’t know how to solve this exactly, but MF is still simple: hj-1pai hjpai hjpai hj-1i hji hj+1i As before, the optimal solution is derived by making logqi equals the sum of affected terms: hj+1l hj-1r hjl hj-1r hjr hj+1r

  13. Simple Mean Field is usually not a good idea Why? Because the MF trial function is very crude For example, we said before that the joint posteriors cannot be approximated by independent product of the hidden variables posteriors A/C A/C A/C C A C A

  14. Exploiting additional structure We can greatly improve accuracy by generalizing the mean field algorithm using larger building blocks The approximation specify independent distributions for each loci, but maintain the tree dependencies. We now optimize each tree q separately, given the current other tree potentials. The key point is that optimizing for any given tree is efficient: we just use a modified up-down algorithm

  15. Tree based variational inference Each tree is only affected by the tree before and the tree after:

  16. Tree based variational inference We got the same functional form as we had for the simple tree, so we can use the up-down algorithm to optimize qj.

  17. Chain cluster variational inference We can use any partition of a BN to trees and derive a similar MF algorithm For example, instead of trees we can use the Markov chains in each species What will work better for us? Depends on the strength of dependencies at each dimension – we should try to capture as much “dependency” as possible

  18. You are P(H|our data) I am P(H|all data) You are P(H|our data) Simple Tree: Inference as message passing s s s s s s s DATA

  19. Factor graphs • Defining the joint probability for a set of random variables given: • Any set of node subsets (hypergraph) • Functions on the node subsets (Potentials) R.V. Factor Joint distribution: Partition function: If the potentials are condition probabilities, what will be Z? Not necessarily 1! (can you think of an example?) Things are difficult when there are several modes

  20. Converting directional models to factor graphs hpaij-1 hpaij hpaij+1 hpaij-1 hpaij hpaij+1 PhyloHMM DBN hij-1 hij hij+1 hij-1 hij hij+1 hpaij-1 hpaij hpaij+1 hpaij-1 hpaij hpaij+1 Z=1 Z=1 hij-1 hij hij+1 hij-1 hij hij+1 hpaij-1 hpaij hpaij+1 hpaij-1 hpaij hpaij+1 Well defined (Loops!) hij-1 hij hij+1 hij-1 hij hij+1 Z!=1

  21. More definitions The model: Potentials can be defined on discrete, real valued etc. it is also common to define general log-linear models directly: Inference: Learning: Find the factors parameterization:

  22. Inference in factor graphs: Algorithms Dynamic programming: No (also not in BN!) Forward sampling (likelihood weighting): No Metropolis/Gibbs: Yes Mean field: Yes Structural variational inference: Yes Directed models are sometimes more natural and easy to understand. Their popularity stems from their original role as expressing knowledge in AI They are not very natural for modeling physical phenomena, except for time-dependent processes Undirected models are analogous to well-developed models in statistical physics (e.g., spin glass models) We borrow computational ideas from physicists (these people are big with approximations) The models are convex which give them important algorithmic properties

  23. Belief propagation in a factor graph • 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..) • 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: (any value attainable by xi)->real values • Messages from variables to factors: • 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

  24. i a i a Messages update rules: Messages from variables to factors: Messages from factors to variables:

  25. Why this is different than the mean field algorithm? The algorithm proceeds by updating messages: • Define the beliefs as approximating single variables posterios (p(hi|s)): Algorithm: Initialize all messages to uniform Iterate until no message change: Update factors to variables messages Update variables to factors messages

  26. i a i a Beliefs on factor inputs This is far from mean field, since for example: • The update rules can be viewed as derived from constraints on the beliefs: • 1.requirement on the variables beliefs (bi) • 2.requirement on the factor beliefs (ba) • 3.Marginalization requirement:

  27. 3 2 1 BP on Tree = Up-Down d h3 c e h1 h2 b a s2 s1 s4 s3

  28. Loopy BP is not guaranteed to converge 1 1 X Y 0 0 This is not a hypothetical scenario – it frequently happens when there is too much symmetry For example, most mutational effects are double stranded and so symmetric which can result in loops.

  29. The Bethe Free Energy • 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.. • 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. H. Bethe Theorem: beliefs are LBP fixed points if and only if they are locally optimal for the Bethe free energy • Compare to the variational free energy:

  30. Generalization: Regions-based free energy • Start with a factor graph (X,A) • Introduce regions (XR,AR) and multipliers cR • We require that: • We will work with valid regions graphs: Region average energy Region Entropy Region Free energy Region-based average energy Region-based entropy Region-based free energy

  31. Bethe regions are the factors neighbors sets and single variables regions: c a b We compensate for the multiple counting of variables using the multiplicity constant We can add larger regions Rac As long as we update the multipliers: Ra Rbc

  32. Multipliers compensate on average, not on entropy Claim: For valid regions, if the regions’ beliefs are exact: then the average region-based energy is exact: We cannot guarantee much on the region-based entropy: Claim: the region-based entropy is exact when the model is a uniform distribution Proof: 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!

  33. 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) Entropy Information (maximal on uniform) (nonnegative, and 0 on uniform)

  34. Example: A Non max-ent approximation 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) Look at the consistent beliefs: The Region entropy (for any region) = ln2. The total region entropy is: We claimed before the entropy of the uniform distribution will be exact: 6ln2

  35. Inference as minimization of region-based free energy We want to solve a variational problem: While enforcing constraints on the regions’ beliefs: Unlike the structured variational approximation we discussed before, and although the beliefs are (regionally) compatible, we can have cases with optimal beliefs that are not representing a true global posterior distribution Optimal region beliefs are identical to the factors: A B It can be shown that this cannot be the result of any joint distribution on the three variables (note the negative feedback loop here) C

  36. Inference as minimization of region-based free energy 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. 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).

  37. The Bethe Lagrangian Large region beliefs are normalized Variable region beliefs are normalized Marginalization

  38. The Bethe lagrangian Take the derivatives with respect to each ba and bi:

  39. Bethe minima are LBP fixed points So here are the conditions: And we can solve them if: 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

  40. Generalizing LBP for region graphs A region graph is graph on subsets of nodes in the factor graph, with valid multipliers (as defined above) • regions (XR,AR) and multipliers cR • We require that: • We will work with valid regions graphs: P(R) D(R) – Decedents of R R P(D(R))\D(R) P(R) – Parents of R D(R) Parent-to-child beliefs:

  41. Generalizing LBP for region graphs Parent-to-child algorithm: D(R) – Decedents of R P(R) – Parents of R Not D(P)+P I D(P)+P P N(I,J) = I not in D(P)+P J in D(P)+P but not D(R)+R R J D(R)+R D(P)+P P D(I,J) = I in D(P)+P but not D(R)+R J in D(R)+R R J I D(R)+R

  42. 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.

More Related