Report

PATTERN RECOGNITION AND MACHINE LEARNING CHAPTER 10 ≈ Approximate Bayesian Inference I: Structural Approximations FALK LIEDER DECEMBER 2 2010 Introduction Variational Inference Variational Bayes Applications Statistical Inference Z Hidden States X P(Z|X) | Observations ↝ Posterior Belief Introduction Variational Inference Variational Bayes Applications When Do You Need Approximations? The problem with Bayes theorem is that it often leads to integrals that you don’t know how to solve. ⋅ () = , = () 1. No analytic solution for = ⋅ ⋅ 2. No analytic solution for | = ⋅ dz 3. In the discrete case computing () has complexity (exp(#dim of Z)) 4. Sequential Learning For Non-Conjugate Priors Introduction Variational Inference Variational Bayes Applications How to Approximate? Samples Approximate Density by Histogram Approx. Expectations by Averages Numerical integration Approximate Integrals Numerically: a) Evidence p(x) b) Expectations Infeasible if Z is highdimensional Structual Approximation Approximation by a Density of a given Form Evidence /Expectations of Approximate Density are easy to compute Introduction Variational Inference Variational Bayes Applications How to Approximate? Structural Approximations (Variational Inference) Stochastic Approximations (Monte-Carlo-Methods, Sampling) + Fast to Compute - Systematic Error + Efficient Representation - Application often requires mathematical derivations + Learning Rules give Insight - Time-Intensive + Asymptotically Exact - Storage Intensive + Easily Applicable General Purpose Algorithms Introduction Variational Inference Variational Bayes Applications Variational Inference—An Intuition Target Family KL-Divergence VB Approximation Probability Distributions True Posterior Introduction Variational Inference Variational Bayes Applications What Does Closest Mean? Intuition: Closest means minimal additional surprise on average. Kullback-Leibler (KL) divergence measures average additional surprise. KL[p||q]= [Surprise ] − [Surprise ()] KL[p||q] measures how much less accurate the belief q is than p, if p is the true belief. KL[p||q] is largest reduction in average surprise that you can achieve, if p is the true belief. Introduction Variational Inference Variational Bayes KL-Divergence Illustration KL[(⋅ |)||] ≔ (|) | ⋅ () Applications Introduction Variational Inference Variational Bayes Applications Properties of the KL-Divergence KL[| (⋅ |) ≔ ⋅ ln () (|) 1. Zero iff both arguments are identical: KL[| ⋅ = 0 ⇔ = 2. Greater than zero, if they are different: KL[| ⋅ > 0 ⇔≠ Disadvantage The KL-divergence is not a metric (distance function), because a) It is not symmetric . b) It does not satisfy the triangle inequality. Introduction Variational Inference Variational Bayes Applications How to Find the Closest Target Density? • Intuition: Minimize Distance • Implementations: – Variational Bayes: Minimize KL[||] – Expectation Propagation: KL[||] • Arbitrariness – Different Measures ⇒ Different Algorithms & Different Results – Alternative Schemes are being developed, e.g. Jaakola-Jordan variational method, Kikuchi-Approximations Introduction Variational Inference Variational Bayes Applications Minimizing Functionals • KL-divergence is a functional Calculus Functions that map vectors to real numbers: : ℝ ↦ ℝ Derivative: Change of (1 , … , ) for infinitesimal changes in 1 , 2 , … , Variational Calculus Functionals map functions to real numbers Functional Derivative: Change of ( −∞ , … , (+∞)) for infinitesimal changes in f −∞ , … , 0 , … , (−∞) Minimizing Functions Minimizing Functionals Find the root of the derivative Find the root of the functional derivative Introduction Variational Inference Variational Bayes Applications VB and the Free-Energy ℱ() Variational Bayes: approximate posterior q = argmin KL[q||p(|)] q∈T Problem: You can’t evaluate the KL-divergence, because you can’t evaluate the posterior. Solution: KL[| = = , ⋅ ln ⋅ ln = ⋅ ln , + ln −ℱ = −ℒ() Conclusion: • You can maximize the free-energy instead. const Introduction Variational Inference Variational Bayes Examples VB: Minimizing KL-Divergence is equivalent to Maximizing Free-Energy ℱ(q) ln () = ℱ() + KL[||] ln () Introduction Variational Inference Variational Bayes Applications Constrained Free-Energy Maximization q = argmax ℱ (q) q∈T Intuition: • Maximize a Lower Bound on the Log Model Evidence • Maximization is restricted to tractable target densities Definition: (, ) ℱ ≔ ⋅ ln dz () Properties • ℱ ≤ ln () • The free-energy is maximal for the true posterior. Introduction Variational Inference Variational Bayes Applications Variational Approximations 1. Factorial Approximations (Meanfield) – Independence Assumption () = =1 ( ) – Optimization with respect to factor densities – No Restriction on Functional Form of the factors 2. Approximation by Parametric Distributions – Optimization w.r.t. Parameters 3. Variational Approximations for Model Comparison – Variational Approximation of the Log Model Evidence Introduction Variational Inference Variational Bayes Examples Meanfield Approximation Goal: 1. Rewrite ℱ() as a function of and optimize. 2. Optimize ℱ( ) separately for each factor Step 1: ℱ = ln , 1 ⋯ + =1 ln 1 ⋯ =1 ln , 1 ⋯ −1 +1 ⋯ ≠ ln , + const ≔ ≠ [ln (, )] Introduction Variational Inference Variational Bayes Applications Meanfield Approximation, Step 1 ℱ = ln , 1 ⋯ − =1 ⋅ =1 ln 1 ⋯ + ln 1 ⋯ =1 ⋅ ln 1 ⋯ ≠ ln 1 ⋯ −1 +1 ⋯ const ln ( ) = qj ⋅ ln (, ) − ⋅ ln + const Introduction Variational Inference Variational Bayes Applications Meanfield Approximation, Step 2 ℱ = qj ⋅ ln (, ) − Notice that ℱ = −[ | , ⋅ ln + const + const. qj = arg max ℱ = , = exp ≠ ln , + const The constant must be the evidence, because qj has to integrate to one. Hence, exp ≠ ln , qj = exp ≠ ln , Introduction Variational Inference Variational Bayes Applications Meanfield Example True Distribution: 1 , 2 = , Λ−1 with = 1 , 2 , Λ = 11 12 Target Family: 1 , 2 = 1 1 ⋅ 2 (2 ) VB meanfield solution: 1. ln q1 z1 = z2 [ln p z1 , z2 ] + const 1 2. z2 [ln p z1 , z2 ] = − 2 λ11 z1 − μ1 2 + 2λ12 (z1 − 12 22 Introduction Variational Inference Variational Bayes Applications Meanfield Example True Density Approximation Observation: VB-Approximation is more compact than true density. Reason: KL[q||p] does not penalize deviations where q is close to 0. KL[| (⋅ |) ≔ ⋅ ln () (|) Unreasonable Assumptions Poor Approximation Introduction Variational Inference Variational Bayes Applications KL[q||p] vs. KL[p||q] Variational Bayes • Analytically Easier • Approx. is more compact Expectation Propagation • More Involved • Approx. is wider Introduction Variational Inference Variational Bayes Applications 2. Parametric Approximations • Problem: – You don’t know how to integrate prior times likelihood. • Solution: – Approximate (|) by q ∈ ⋅ ; : ∈ Θ . – KL-divergence and free-energy become functions of the parameters – Apply standard optimization techniques. – Setting derivatives to zero One equation per parameter. – Solve System of Equations by iterative Updating. Introduction Variational Inference Variational Bayes Applications Parametric Approximation Example Goal: Learn the Reward Probability p • Likelihood: ∼ , , = 1/(1 + exp(−20 − 4)) • Prior: ∼ (0,1) • Posterior: = 1 ∝ Problem exp(− 2 /2) 1+exp(−20+4) ℝ Z X 0,1 You cannot derive a learning rule for the expected reward and ist variance, because… a) No Analytic Formula for Expected Reward Probability b) Form of Prior Changes with Every Observation Solution: Approximate the Posterior by a Gaussian. Introduction Variational Inference Variational Bayes Applications Solution (, ) = arg min KL[(, )| (|) = arg max ℱ((, ) , Solve , KL[(, )||] ℱ((, ) I =− =0 KL[(, )||] ℱ((, ) II =− =0 Introduction Variational Inference Variational Bayes Applications Result: A Global Approximation Learning Rules for expected reward probability and the uncertainty about it Sequential Learning Algorithm True Posterior Laplace Variational Bayes Introduction Variational Inference Variational Bayes Applications VB for Bayesian Model Selection • = ⋅() () ∝ ⋅ • Hence, if is uniform ∝ (|). • Problem: – = (|) ⋅ , is “intractable” • Solution: – ln (|) = ℱ + KL[||(|)] – ln (|) ≈ max ℱ ∈ • Justification: – If ∈ , then = – ⇒ KL[max ||(|)]=0 ⇒ ℱ max = ln (|) Motivation & Overview VI Intuition VB Maths Applications Summary Approximate Bayesian Inference Structural Approximations Variational Bayes (Ensemble Learning) Meanfield Parametric Approx. Learning Rules, Model Selection