Approximate Inference: Sampling Methods CMSC 691 UMBC
(Some) Learning Techniques MAP/MLE: Point estimation, basic EM Variational Inference: Functional Optimization Sampling/Monte Carlo today
Outline Monte Carlo methods Sampling Techniques Uniform sampling Importance Sampling Rejection Sampling Metropolis-Hastings Gibbs sampling Example: Collapsed Gibbs Sampler for Topic Models
Two Problems for Sampling Methods to Solve Generate samples from p π π¦ = π£ π¦ , π¦ β β πΈ π π¦ 1 , π¦ 2 , β¦ , π¦ π samples Q : Why might sampling from p(x) be hard?
Two Problems for Sampling Methods to Solve Generate samples from p π π¦ = π£ π¦ , π¦ β β πΈ π π¦ 1 , π¦ 2 , β¦ , π¦ π samples Q : Why might sampling from p(x) be hard? A1 : Can we evaluate Z? A2 : Can we sample without enumerating? (Correct samples should be where p is big)
Two Problems for Sampling Methods to Solve Generate samples from p π π¦ = π£ π¦ , π¦ β β πΈ π π¦ 1 , π¦ 2 , β¦ , π¦ π samples Q : Why might sampling from p(x) be hard? A1 : Can we evaluate Z? A2 : Can we sample without π£ π¦ = exp(.4 π¦ β .4 2 β 0.08π¦ 4 ) ITILA, Fig enumerating? (Correct samples 29.1 should be where p is big)
Two Problems for Sampling Methods to Solve Estimate expectation of a Generate samples from p function π π π¦ = π£ π¦ , π¦ β β πΈ Ξ¦ = π π¦ π = π½ π¦βΌπ π π¦ = π β« π π¦ π π¦ ππ¦ π¦ 1 , π¦ 2 , β¦ , π¦ π samples Q : Why might sampling from p(x) be hard? A1 : Can we evaluate Z? A2 : Can we sample without enumerating? (Correct samples should be where p is big)
Two Problems for Sampling Methods to Solve Estimate expectation of a Generate samples from p function π π π¦ = π£ π¦ , π¦ β β πΈ Ξ¦ = π π¦ π = π½ π¦βΌπ π π¦ = π β« π π¦ π π¦ ππ¦ π¦ 1 , π¦ 2 , β¦ , π¦ π samples 1 ΰ·‘ π Ο π π π¦ π Ξ¦ = Q : Why might sampling from p(x) be hard? A1 : Can we evaluate Z? A2 : Can we sample without enumerating? (Correct samples should be where p is big)
Two Problems for Sampling Methods to Solve Estimate expectation of a Generate samples from p function π π π¦ = π£ π¦ , π¦ β β πΈ Ξ¦ = π π¦ π = π½ π¦βΌπ π π¦ = π β« π π¦ π π¦ ππ¦ π¦ 1 , π¦ 2 , β¦ , π¦ π samples 1 ΰ·‘ π Ο π π π¦ π Ξ¦ = Q : Why is sampling from p(x) hard? If we could sample from pβ¦ A1 : Can we evaluate Z? consistent π½ ΰ·‘ A2 : Can we sample without Ξ¦ = Ξ¦ estimator enumerating? (Correct samples should be where p is big)
Outline Monte Carlo methods Sampling Techniques Uniform sampling Importance Sampling Rejection Sampling Metropolis-Hastings Gibbs sampling Example: Collapsed Gibbs Sampler for Topic Models
Goal: Uniform Sampling Ξ¦ = π π¦ π = π½ π¦βΌπ π π¦ sample ΰ·‘ π π¦ π π β (π¦ π ) Ξ¦ = ΰ· uniformly : π¦ 1 , π¦ 2 , β¦ , π¦ π π
Goal: Uniform Sampling Ξ¦ = π π¦ π = π½ π¦βΌπ π π¦ sample ΰ·‘ π π¦ π π β (π¦ π ) Ξ¦ = ΰ· uniformly : π¦ 1 , π¦ 2 , β¦ , π¦ π π π β π¦ = π£ π¦ π β π β = ΰ· π£(π¦ π ) π
Goal: Uniform Sampling Ξ¦ = π π¦ π = π½ π¦βΌπ π π¦ sample ΰ·‘ π π¦ π π β (π¦ π ) Ξ¦ = ΰ· uniformly : π¦ 1 , π¦ 2 , β¦ , π¦ π π π β π¦ = π£ π¦ π β π β = ΰ· π£(π¦ π ) π this might work if R (the number of samples) sufficiently hits high probability regions
Goal: Uniform Sampling Ξ¦ = π π¦ π = π½ π¦βΌπ π π¦ sample ΰ·‘ π π¦ π π β (π¦ π ) Ξ¦ = ΰ· uniformly : π¦ 1 , π¦ 2 , β¦ , π¦ π π π β π¦ = π£ π¦ π β π β = ΰ· π£(π¦ π ) π this might work if R Ising model example: (the number of 2 H states of high β’ samples) sufficiently probability hits high probability 2 N states total β’ regions
Goal: Uniform Sampling Ξ¦ = π π¦ π = π½ π¦βΌπ π π¦ sample ΰ·‘ π π¦ π π β (π¦ π ) Ξ¦ = ΰ· uniformly : π¦ 1 , π¦ 2 , β¦ , π¦ π π π β π¦ = π£ π¦ π β π β = ΰ· π£(π¦ π ) π this might work if R chance of sample being in Ising model example: 2 πΌ (the number of 2 H states of high high prob. region: β’ 2 π samples) sufficiently probability hits high probability 2 N states total β’ min. samples needed: βΌ 2 πβπΌ regions
Outline Monte Carlo methods Sampling Techniques Uniform sampling Importance Sampling Rejection Sampling Metropolis-Hastings Gibbs sampling Example: Collapsed Gibbs Sampler for Topic Models
Goal: Importance Sampling Ξ¦ = π π¦ π = π½ π¦βΌπ π π¦ approximating distribution: π π¦ β π£ π π¦ sample from Q : π¦ 1 , π¦ 2 , β¦ , π¦ π ITILA, Fig 29.5
Goal: Importance Sampling Ξ¦ = π π¦ π = π½ π¦βΌπ π π¦ approximating distribution: π π¦ β π£ π π¦ sample from Q : π¦ 1 , π¦ 2 , β¦ , π¦ π p(x) x where Q(x) > p(x): over-represented x where Q(x) < p(x): under-represented ITILA, Fig 29.5
Goal: Importance Sampling Ξ¦ = π π¦ π = π½ π¦βΌπ π π¦ approximating distribution: Ξ¦ = Ο π π π¦ π π₯(π¦ π ) π π¦ β π£ π π¦ ΰ·‘ Ο π π₯ π¦ π sample from Q : π¦ 1 , π¦ 2 , β¦ , π¦ π p(x) x where Q(x) > p(x): π₯ π¦ π = π£ π π¦ over-represented π£ π π¦ x where Q(x) < p(x): under-represented ITILA, Fig 29.5
Goal: Importance Sampling Ξ¦ = π π¦ π = π½ π¦βΌπ π π¦ approximating distribution: Ξ¦ = Ο π π π¦ π π₯(π¦ π ) π π¦ β π£ π π¦ ΰ·‘ Ο π π₯ π¦ π sample from Q : π¦ 1 , π¦ 2 , β¦ , π¦ π p(x) x where Q(x) > p(x): π₯ π¦ π = π£ π π¦ over-represented π£ π π¦ x where Q(x) < p(x): under-represented Q : How reliable will ITILA, Fig 29.5 this estimator be?
Goal: Importance Sampling Ξ¦ = π π¦ π = π½ π¦βΌπ π π¦ approximating distribution: Ξ¦ = Ο π π π¦ π π₯(π¦ π ) π π¦ β π£ π π¦ ΰ·‘ Ο π π₯ π¦ π sample from Q : π¦ 1 , π¦ 2 , β¦ , π¦ π p(x) x where Q(x) > p(x): π₯ π¦ π = π£ π π¦ over-represented π£ π π¦ x where Q(x) < p(x): under-represented A : In practice, difficult Q : How reliable will ITILA, Fig 29.5 to say. π₯ π¦ π may not this estimator be? be a good indicator
Goal: Importance Sampling Ξ¦ = π π¦ π = π½ π¦βΌπ π π¦ approximating distribution: Ξ¦ = Ο π π π¦ π π₯(π¦ π ) π π¦ β π£ π π¦ ΰ·‘ Ο π π₯ π¦ π sample from Q : x where Q(x) > p(x): π₯ π¦ π = π£ π π¦ over-represented π¦ 1 , π¦ 2 , β¦ , π¦ π π£ π π¦ x where Q(x) < p(x): under-represented p(x) A : In practice, difficult Q : How reliable will to say. π₯ π¦ π may not this estimator be? be a good indicator Q : How do you choose a good approximating ITILA, Fig 29.5 distribution?
Goal: Importance Sampling Ξ¦ = π π¦ π = π½ π¦βΌπ π π¦ approximating distribution: Ξ¦ = Ο π π π¦ π π₯(π¦ π ) π π¦ β π£ π π¦ ΰ·‘ Ο π π₯ π¦ π sample from Q : x where Q(x) > p(x): π₯ π¦ π = π£ π π¦ over-represented π¦ 1 , π¦ 2 , β¦ , π¦ π π£ π π¦ x where Q(x) < p(x): under-represented p(x) A : In practice, difficult Q : How reliable will to say. π₯ π¦ π may not this estimator be? be a good indicator Q : How do you choose A : Task/domain a good approximating ITILA, Fig 29.5 specific distribution?
Importance Sampling: Variance Estimator may vary q(x): Gaussian q(x): Cauchy distribution true value iterations ITILA, Fig 29.6
Outline Monte Carlo methods Sampling Techniques Uniform sampling Importance Sampling Rejection Sampling Metropolis-Hastings Gibbs sampling Example: Collapsed Gibbs Sampler for Topic Models
Goal: Rejection Sampling Ξ¦ = π π¦ π = π½ π¦βΌπ π π¦ approximating distribution: π π¦ β π£ π π¦ , π β π£ π > π£ π π β π£ π π¦ π£ π π¦ ITILA, Fig 29.8
Goal: Rejection Sampling Ξ¦ = π π¦ π = π½ π¦βΌπ π π¦ approximating distribution: π π¦ β π£ π π¦ , π β π£ π > π£ π sample from Q : π¦ 1 , π¦ 2 , β¦ , π¦ π β select sample uniformly : tuples π¨ π βΌ Unif(0, π β π£ π π¦ π ) π β π£ π π¦ π£ π π¦ ITILA, Fig 29.8
Goal: Rejection Sampling Ξ¦ = π π¦ π = π½ π¦βΌπ π π¦ approximating distribution: if π¨ π β€ π£ π π¦ π : add π¦ π to π π¦ β π£ π π¦ , π β π£ π > π£ π sampled R points otherwise: reject it sample from Q : π¦ 1 , π¦ 2 , β¦ , π¦ π β select sample uniformly : tuples π¨ π βΌ Unif(0, π β π£ π π¦ π ) π β π£ π π¦ π β π£ π π¦ π£ π π¦ π£ π π¦ π¨ ITILA, Fig 29.8
Recommend
More recommend