Maximum Likelihood (ML), Expecta6on Maximiza6on (EM) - - PowerPoint PPT Presentation

maximum likelihood ml expecta6on maximiza6on em
SMART_READER_LITE
LIVE PREVIEW

Maximum Likelihood (ML), Expecta6on Maximiza6on (EM) - - PowerPoint PPT Presentation

Maximum Likelihood (ML), Expecta6on Maximiza6on (EM) Pieter Abbeel UC Berkeley EECS Many slides adapted from Thrun, Burgard and Fox,


slide-1
SLIDE 1

Maximum ¡Likelihood ¡(ML), ¡ ¡ Expecta6on ¡Maximiza6on ¡(EM) ¡

¡ ¡ Pieter ¡Abbeel ¡ UC ¡Berkeley ¡EECS ¡ ¡ ¡ ¡

Many ¡slides ¡adapted ¡from ¡Thrun, ¡Burgard ¡and ¡Fox, ¡ProbabilisAc ¡RoboAcs ¡

¡

slide-2
SLIDE 2

n Maximum ¡likelihood ¡(ML) ¡ n Priors, ¡and ¡maximum ¡a ¡posteriori ¡(MAP) ¡ n Cross-­‑validaAon ¡ n ExpectaAon ¡MaximizaAon ¡(EM) ¡

Outline ¡

slide-3
SLIDE 3

n Let ¡θ ¡= ¡P(up), ¡ ¡1-­‑θ ¡= ¡P(down) ¡ n How ¡to ¡determine ¡θ ¡? ¡ n Empirical ¡esAmate: ¡ ¡8 ¡up, ¡2 ¡down ¡à ¡

Thumbtack ¡

slide-4
SLIDE 4

n

hTp://web.me.com/todd6ton/Site/Classroom_Blog/Entries/ 2009/10/7_A_Thumbtack_Experiment.html ¡

slide-5
SLIDE 5

n

θ ¡= ¡P(up), ¡ ¡1-­‑θ ¡= ¡P(down) ¡

n

Observe: ¡

n

Likelihood ¡of ¡the ¡observaAon ¡sequence ¡depends ¡on ¡θ: ¡

n

Maximum ¡likelihood ¡finds ¡ ¡

à extrema ¡at ¡θ ¡= ¡0, ¡θ ¡= ¡1, ¡θ ¡= ¡0.8 ¡ à InspecAon ¡of ¡each ¡extremum ¡yields ¡ θML ¡= ¡0.8 ¡ ¡

Maximum ¡Likelihood ¡

slide-6
SLIDE 6

n

More ¡generally, ¡consider ¡binary-­‑valued ¡random ¡variable ¡with ¡θ ¡= ¡P(1), ¡1-­‑θ ¡= ¡P(0), ¡assume ¡we ¡

  • bserve ¡n1 ¡ones, ¡and ¡n0 ¡zeros ¡

n

Likelihood: ¡

n

DerivaAve: ¡

n

Hence ¡we ¡have ¡for ¡the ¡extrema: ¡

n

n1/(n0+n1) ¡is ¡the ¡maximum ¡

n

= ¡empirical ¡counts. ¡ ¡

Maximum ¡Likelihood ¡

slide-7
SLIDE 7

n

The ¡funcAon ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ is ¡a ¡monotonically ¡increasing ¡funcAon ¡of ¡x ¡

n

Hence ¡for ¡any ¡(posiAve-­‑valued) ¡funcAon ¡f: ¡

n

Oaen ¡more ¡convenient ¡to ¡opAmize ¡log-­‑likelihood ¡rather ¡than ¡likelihood ¡ ¡

n

Example: ¡ ¡ ¡ ¡

Log-­‑likelihood ¡

slide-8
SLIDE 8

n

Reconsider ¡thumbtacks: ¡8 ¡up, ¡2 ¡down ¡

n Likelihood ¡

n

DefiniAon: ¡A ¡funcAon ¡f ¡is ¡concave ¡if ¡and ¡only ¡

n

Concave ¡funcAons ¡are ¡generally ¡easier ¡to ¡maximize ¡then ¡non-­‑concave ¡ funcAons ¡ ¡

Log-­‑likelihood ¡ßà ¡Likelihood ¡

n Log-­‑likelihood ¡

Concave ¡ Not ¡Concave ¡

slide-9
SLIDE 9

f ¡is ¡concave ¡if ¡and ¡only ¡ ¡ ¡ ¡ ¡

¡

“Easy” ¡to ¡maximize ¡

Concavity ¡and ¡Convexity ¡

x1

x2

λx2+(1-λ)x2

f is convex if and only “Easy” to minimize

x1

x2

λ x2+(1-λ)x2

slide-10
SLIDE 10

n Consider ¡having ¡received ¡samples ¡

ML ¡for ¡MulAnomial ¡

slide-11
SLIDE 11

n

Given ¡samples ¡

n

Dynamics ¡model: ¡

n

ObservaAon ¡model: ¡ ¡ ¡ ¡ ¡

¡

à ¡Independent ¡ML ¡problems ¡for ¡each ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡and ¡each ¡ ¡

ML ¡for ¡Fully ¡Observed ¡HMM ¡

slide-12
SLIDE 12

n Consider ¡having ¡received ¡samples ¡

n 3.1, ¡8.2, ¡1.7 ¡

ML ¡for ¡ExponenAal ¡DistribuAon ¡

Source: wikipedia

ll

slide-13
SLIDE 13

n Consider ¡having ¡received ¡samples ¡

¡ ¡

ML ¡for ¡ExponenAal ¡DistribuAon ¡

Source: wikipedia

slide-14
SLIDE 14

n Consider ¡having ¡received ¡samples ¡

¡ ¡

Uniform ¡

slide-15
SLIDE 15

n Consider ¡having ¡received ¡samples ¡

ML ¡for ¡Gaussian ¡

slide-16
SLIDE 16

Equivalently: ¡ ¡ More ¡generally: ¡

ML ¡for ¡CondiAonal ¡Gaussian ¡

slide-17
SLIDE 17

ML ¡for ¡CondiAonal ¡Gaussian ¡

slide-18
SLIDE 18

ML ¡for ¡CondiAonal ¡MulAvariate ¡Gaussian ¡

slide-19
SLIDE 19

Aside: ¡Key ¡IdenAAes ¡for ¡DerivaAon ¡on ¡Previous ¡Slide ¡

slide-20
SLIDE 20

n

Consider ¡the ¡Linear ¡Gaussian ¡segng: ¡

n

Fully ¡observed, ¡i.e., ¡given ¡

n

à ¡Two ¡separate ¡ML ¡esAmaAon ¡problems ¡for ¡condiAonal ¡mulAvariate ¡ Gaussian: ¡ ¡

n

1: ¡

n

2: ¡ ¡ ¡ ¡

ML ¡EsAmaAon ¡in ¡Fully ¡Observed ¡Linear ¡Gaussian ¡Bayes ¡Filter ¡Segng ¡

slide-21
SLIDE 21

n

Let ¡θ ¡= ¡P(up), ¡ ¡1-­‑θ ¡= ¡P(down) ¡

n

How ¡to ¡determine ¡θ ¡? ¡

n

ML ¡esAmate: ¡ ¡5 ¡up, ¡0 ¡down ¡à ¡

n

Laplace ¡esAmate: ¡add ¡a ¡fake ¡count ¡of ¡1 ¡for ¡each ¡outcome ¡

Priors ¡-­‑-­‑-­‑ ¡Thumbtack ¡

slide-22
SLIDE 22

n AlternaAvely, ¡consider ¡θ ¡to ¡be ¡random ¡variable ¡ n Prior ¡P(θ) ¡= C ¡θ(1-­‑θ) ¡ n Measurements: ¡P( ¡x ¡| ¡θ ¡) ¡ n Posterior: ¡ n Maximum ¡A ¡Posterior ¡(MAP) ¡esAmaAon ¡ ¡

n = ¡find ¡θ ¡that ¡maximizes ¡the ¡posterior ¡ ¡ ¡ ¡ ¡

à ¡ ¡

Priors ¡-­‑-­‑-­‑ ¡Thumbtack ¡

slide-23
SLIDE 23

Priors ¡-­‑-­‑-­‑ ¡Beta ¡DistribuAon ¡

Figure source: Wikipedia

slide-24
SLIDE 24

n Generalizes ¡Beta ¡distribuAon ¡ n MAP ¡esAmate ¡corresponds ¡to ¡adding ¡fake ¡

counts ¡n1, ¡…, ¡nK

Priors ¡-­‑-­‑-­‑ ¡Dirichlet ¡DistribuAon ¡

slide-25
SLIDE 25

n

Assume ¡variance ¡known. ¡ ¡(Can ¡be ¡extended ¡to ¡also ¡find ¡MAP ¡for ¡variance.) ¡ n Prior: ¡ ¡

MAP ¡for ¡Mean ¡of ¡Univariate ¡Gaussian ¡

slide-26
SLIDE 26

n

Assume ¡variance ¡known. ¡ ¡(Can ¡be ¡extended ¡to ¡also ¡find ¡MAP ¡for ¡variance.) ¡

n

Prior: ¡ ¡

MAP ¡for ¡Univariate ¡CondiAonal ¡Linear ¡Gaussian ¡

[Interpret!]

slide-27
SLIDE 27

MAP ¡for ¡Univariate ¡CondiAonal ¡Linear ¡Gaussian: ¡Example ¡

TRUE --- Samples . ML --- MAP ---

slide-28
SLIDE 28

n

Choice ¡of ¡prior ¡will ¡heavily ¡influence ¡quality ¡of ¡result ¡

n

Fine-­‑tune ¡choice ¡of ¡prior ¡through ¡cross-­‑validaAon: ¡

n 1. ¡Split ¡data ¡into ¡“training” ¡set ¡and ¡“validaAon” ¡set ¡ n 2. ¡For ¡a ¡range ¡of ¡priors, ¡ ¡

n Train: ¡compute ¡θMAP on training set n Cross-validate: evaluate performance on validation set by evaluating the likelihood of the

validation data under θMAP just found

n 3. ¡Choose ¡prior ¡with ¡highest ¡validaAon ¡score ¡ ¡

n For ¡this ¡prior, ¡compute ¡θMAP on (training+validation) set ¡

n

Typical ¡training ¡/ ¡validaAon ¡splits: ¡

n

1-­‑fold: ¡70/30, ¡random ¡split ¡

n

10-­‑fold: ¡parAAon ¡into ¡10 ¡sets, ¡average ¡performance ¡for ¡each ¡set ¡being ¡the ¡validaAon ¡set ¡and ¡the ¡other ¡9 ¡being ¡the ¡training ¡set ¡

Cross ¡ValidaAon ¡

slide-29
SLIDE 29

n Maximum ¡likelihood ¡(ML) ¡ n Priors, ¡and ¡maximum ¡a ¡posteriori ¡(MAP) ¡ n Cross-­‑validaAon ¡ n Expecta6on ¡Maximiza6on ¡(EM) ¡

Outline ¡

slide-30
SLIDE 30

n

Generally: ¡

n

Example: ¡ ¡

n

ML ¡ObjecAve: ¡given ¡data ¡z(1), ¡…, ¡z(m)

n

Setting derivatives w.r.t. θ, µ, Σ equal to zero does not enable to solve for their ML estimates in closed form

We ¡can ¡evaluate ¡funcAon ¡à ¡we ¡can ¡in ¡principle ¡perform ¡local ¡opAmizaAon. ¡ ¡In ¡this ¡lecture: ¡“EM” ¡algorithm, ¡which ¡is ¡typically ¡used ¡to ¡efficiently ¡opAmize ¡ the ¡objecAve ¡(locally) ¡ ¡

Mixture ¡of ¡Gaussians ¡

slide-31
SLIDE 31

n

Example: ¡

n

Model: ¡

n

Goal: ¡ ¡

n

Given ¡data ¡z(1), ¡…, ¡z(m) (but no x(i) observed) ¡

n

Find ¡maximum ¡likelihood ¡esAmates ¡of ¡μ1, ¡μ2

n

EM basic idea: if x(i) were known à two easy-to-solve separate ML problems

n

EM iterates over

n

E-step: For i=1,…,m fill in missing data x(i) according to what is most likely given the current model ¹

n

M-step: run ML for completed data, which gives new model ¹

ExpectaAon ¡MaximizaAon ¡(EM) ¡

slide-32
SLIDE 32

n

EM ¡solves ¡a ¡Maximum ¡Likelihood ¡problem ¡of ¡the ¡form: ¡ ¡ ¡ µ: ¡parameters ¡of ¡the ¡probabilisAc ¡model ¡we ¡try ¡to ¡find ¡ x: ¡unobserved ¡variables ¡ z: ¡observed ¡variables ¡ ¡ ¡ ¡

EM ¡DerivaAon ¡

Jensen’s Inequality

slide-33
SLIDE 33

Jensen’s ¡inequality ¡

x1

x2

E[X] = λx1+(1-λ)x2

Illustration: P(X=x1) = 1-λ, P(X=x2) = λ

slide-34
SLIDE 34

EM ¡Algorithm: ¡Iterate ¡ ¡1. ¡E-­‑step: ¡Compute ¡ ¡2. ¡M-­‑step: ¡Compute ¡ ¡ ¡ ¡

EM ¡DerivaAon ¡(ctd) ¡

Jensen’s Inequality: equality holds when is an affine function. This is achieved for

M-step optimization can be done efficiently in most cases E-step is usually the more expensive step It does not fill in the missing data x with hard values, but finds a distribution q(x)

slide-35
SLIDE 35

n

M-­‑step ¡objecAve ¡is ¡ upper-­‑bounded ¡by ¡ true ¡objecAve ¡

n

M-­‑step ¡objecAve ¡is ¡ equal ¡to ¡true ¡objecAve ¡ at ¡current ¡parameter ¡ esAmate ¡ ¡

EM ¡DerivaAon ¡(ctd) ¡

n

à Improvement in true objective is at least as large as improvement in M-step objective

slide-36
SLIDE 36

n

EsAmate ¡1-­‑d ¡mixture ¡of ¡two ¡Gaussians ¡with ¡unit ¡variance: ¡

n ¡ ¡ n one ¡parameter ¡μ; ¡μ1 ¡= ¡μ ¡-­‑ ¡7.5, ¡μ2 ¡= ¡μ ¡+ ¡7.5 ¡

EM ¡1-­‑D ¡Example ¡-­‑-­‑-­‑ ¡2 ¡iteraAons ¡

slide-37
SLIDE 37

n X ¡~ ¡MulAnomial ¡DistribuAon, ¡P(X=k ¡; ¡θ) ¡= ¡θk n Z ¡~ ¡N(μk, ¡Σk) ¡ n Observed: ¡z(1), ¡z(2), ¡…, ¡z(m)

EM ¡for ¡Mixture ¡of ¡Gaussians ¡

slide-38
SLIDE 38

n E-­‑step: ¡ n M-step:

EM ¡for ¡Mixture ¡of ¡Gaussians ¡

slide-39
SLIDE 39

n

Given ¡samples ¡

n

Dynamics ¡model: ¡

n

ObservaAon ¡model: ¡ ¡ ¡

n

ML ¡objecAve: ¡ ¡ ¡

à No ¡simple ¡decomposiAon ¡into ¡independent ¡ML ¡problems ¡for ¡each ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡and ¡each ¡ ¡ à No ¡closed ¡form ¡soluAon ¡found ¡by ¡segng ¡derivaAves ¡equal ¡to ¡zero ¡

ML ¡ObjecAve ¡HMM ¡

slide-40
SLIDE 40

à ¡θ ¡and ¡γ ¡computed ¡from ¡“soa” ¡counts ¡ ¡

EM ¡for ¡HMM ¡-­‑-­‑-­‑ ¡M-­‑step ¡

slide-41
SLIDE 41

n No ¡need ¡to ¡find ¡condiAonal ¡full ¡joint ¡ ¡ n Run ¡smoother ¡to ¡find: ¡

EM ¡for ¡HMM ¡-­‑-­‑-­‑ ¡E-­‑step ¡

slide-42
SLIDE 42

n Linear ¡Gaussian ¡segng: ¡ n Given ¡ n ML ¡objecAve: ¡ n EM-­‑derivaAon: ¡same ¡as ¡HMM ¡

ML ¡ObjecAve ¡for ¡Linear ¡Gaussians ¡

slide-43
SLIDE 43

n Forward: ¡ n Backward: ¡

EM ¡for ¡Linear ¡Gaussians ¡-­‑-­‑-­‑ ¡E-­‑Step ¡

slide-44
SLIDE 44

EM ¡for ¡Linear ¡Gaussians ¡-­‑-­‑-­‑ ¡M-­‑step ¡

[Updates for A, B, C, d. TODO: Fill in once found/derived.]

slide-45
SLIDE 45

n When ¡running ¡EM, ¡it ¡can ¡be ¡good ¡to ¡keep ¡track ¡of ¡the ¡log-­‑

likelihood ¡score ¡-­‑-­‑-­‑ ¡it ¡is ¡supposed ¡to ¡increase ¡every ¡iteraAon ¡

EM ¡for ¡Linear ¡Gaussians ¡-­‑-­‑-­‑ ¡The ¡Log-­‑likelihood ¡ ¡

slide-46
SLIDE 46

n As ¡the ¡linearizaAon ¡is ¡only ¡an ¡approximaAon, ¡when ¡performing ¡

the ¡updates, ¡we ¡might ¡end ¡up ¡with ¡parameters ¡that ¡result ¡in ¡a ¡ lower ¡(rather ¡than ¡higher) ¡log-­‑likelihood ¡score ¡

n à ¡SoluAon: ¡instead ¡of ¡updaAng ¡the ¡parameters ¡to ¡the ¡newly ¡

esAmated ¡ones, ¡interpolate ¡between ¡the ¡previous ¡parameters ¡ and ¡the ¡newly ¡esAmated ¡ones. ¡ ¡Perform ¡a ¡“line-­‑search” ¡to ¡find ¡ the ¡segng ¡that ¡achieves ¡the ¡highest ¡log-­‑likelihood ¡score ¡

EM ¡for ¡Extended ¡Kalman ¡Filter ¡Segng ¡