Learnng Sequence Classfers pplcans f Sequence Classfers Oulne pplcans f sequence classfcan ag f wrds, n-grams, and relaed mdels Markv mdels Hdden Markv mdels Hgher rder Markv mdels Varans n Hdden Markv Mdels pplcans Speech recgnn Naural language prcessng e prcessng Gesure recgnn lgcal sequence analyss gene denfcan pren classfcan 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar ag f wrds, n-grams and relaed mdels ag f wrds, n-grams and relaed mdels Map arbrary lengh sequences fed lengh feaure represenans ag f wrds represen sequences by feaure vecrs wh as many cmpnens as here are wrds n he vcabulary n-grams shr subsequences f n leers Ignre relave rderng f wrds r n-grams alng he sequence ca chased he muse and muse chased he ca have dencal bag f wrds represenans Fed lengh feaure represenans make pssble apply machne learnng mehds ha wrk wh feaure-based represenans Feaures Gven (as n he case f wrds Englsh vcabulary) Dscvered frm daa cmpue sascs f ccurrence f n-grams n daa If varable lengh n-grams are allwed, need ake n accun pssble verlaps Cmpuan f n-gram frequences can be made effcen usng dynamc prgrammng f a srng appears k mes n a pece f e, any subsrng f he srng appears a leas k mes n he e 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 3 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 4 Markv mdels (Markv Chans) Markv mdel s a prbablsc mdel f symbl sequences n whch he prbably f he curren even s depends nly n he mmedaely precedng even. Cnsder a sequence f randm varables,,, N. hnk f he subscrps as ndcang wrd psn n a senence r a leer psn n a sequence Recall ha a randm varable s a funcn In he case f senences made f wrds, he range f he randm varables s he vcabulary f he language. In he case f DN sequences, he randm varables ake n values frm a 4-leer alphabe {, C, G, } Smple Mdel - Markv Chans Markv Prpery: he sae f he sysem a me + nly depends n he sae f he sysem a me P[ + P[ + + +, ] - -,...,, 3 4 5 0 0 ] 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 5 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 6
Markv chans he fac ha subscrp appears n bh he and he n s a b abusve f nan. I mgh be beer wre: P ( s, s,..., s ) where { v... v } Range ( ) s In wha fllws, we wll abuse nan L Markv Chans Sanary -- Prbables are ndependen f when he prcess s sanary. P[ ] a + hs means ha f sysem s n sae, he prbably ha he sysem wll ransn sae s p regardless f he value f 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 7 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar Descrbng a Markv Chan he fundamenal quesns Markv chan can be descrbed by he ransn mar and nal sae prbables Q: a ) + q ), K, ) ) ) ) q P ( K (, ) + Lkelhd Gven a mdel µ (,Q), hw can we effcenly cmpue he lkelhd f an bservan P ( µ )? Fr any sae sequence (,, ): (,..., ) q a a La P 3 Learnng Gven a se f bservan sequences, and a generc mdel, hw can we esmae he parameers ha defne he bes mdel descrbe he daa? Use sandard esman mehds mamum lkelhd r ayesan esmaes dscussed earler n he curse 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 0 Smple Eample f a Markv mdel Weaher ranng day ran mrrw a rr 4 ranng day n ran mrrw a rn 6 n ranng day ran mrrw a nr n ranng day n ran mrrw a rr 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar Smple Eample f a Markv mdel 4 6 3 Q 7 Ne ha bh he ransn mar and he nal sae mar are Schasc Marces (rws sum ) Ne ha n general, he ransn prbables beween w saes need n be symmerc ( a a ) and he prbably f ransn frm a sae self ( a ) need n be zer 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar
ypes f Markv mdels Ergdc mdels Ergdc mdel - Srngly cnneced dreced pah wh psve prbables frm each sae each sae (bu n necessarly a cmplee dreced graph). ha s, fr all, a >0; a >0 ypes f Mdels LR mdels Lef--Rgh (LR) mdel -- Inde f sae nndecreasng wh me 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 3 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 4 Markv mdels wh absrbng saes each play Gambler wns $ wh prbably p r Gambler lses $ wh prbably -p Game ends when gambler ges brke, r gans a frune f $00 -- h $0 and $00 are absrbng saes p p p p 0 N- N -p -p -p -p Sar (0$) 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 5 Cke vs. Peps Gven ha a persn s las cla purchase was Cke, here s a 0% chance ha her ne cla purchase wll als be Cke. If a persn s las cla purchase was Peps, here s an 0% chance ha her ne cla purchase wll als be Peps. cke peps 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 6 Cke vs. Peps Gven ha a persn s currenly a Peps purchaser, wha s he prbably ha she wll purchase Cke w purchases frm nw? he ransn mar s: (Crrespndng ne purchase ahead) 3 34 7 66 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 7 3 Cke vs. Peps Gven ha a persn s currenly a Cke drnker, wha s he prbably ha she wll purchase Peps hree purchases frm nw? 3 34 7 7 66 43 56 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar
Cke vs. Peps ssume each persn makes ne cla purchase per week. Suppse 60% f all peple nw drnk Cke, and 40% drnk Peps. Wha fracn f peple wll be drnkng Cke hree weeks frm nw? Le (q 0,q )(6,4) be he nal prbables. We wll dene Cke by 0 and Peps by We wan fnd 3 0) ( 3) ( 3) ( 3) 3 0) qa0 q0a00 + qq0 6 7+ 4 43 643 0 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar a 00 Hdden Markv Mdels In many scenars saes cann be drecly bserved. We need an eensn -- Hdden Markv Mdels a a a 33 a 44 a a 3 a 34 b b b 4 b 3 b + b + b 3 + b 4, 4 b + b + b 3 + b 4, ec. 3 Observans a are sae ransn prbables. b k are bservan (upu) prbables. 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 0 Eample: Dshnes Casn Wha s an HMM? Wha s hdden n hs mdel? Sae sequences Yu are allwed see he ucme f a de rll Yu d n knw whch ucmes were baned by a far de and whch ucmes were baned by a laded de 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar Green crcles are hdden saes Each hdden sae s dependen nly n he prevus sae: Markv prcess he pas s ndependen f he fuure gven he presen. 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar Wha s an HMM? Specfyng HMM O O O Purple ndes are bserved saes Each bserved sae s dependen nly n he crrespndng hdden sae 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 3 {,O,,, } Π {π } ι are he nal sae prbables {a } are he sae ransn prbables {b k } are he bservan sae prbables 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 4
Fundamenal prblems Cn-ssng Eample Sar al / / / al /4 Far laded / 3/4 head head Lkelhd Cmpue he prbably f a gven bservan sequence gven a mdel Decdng Gven an bservan sequence, and a mdel, cmpue he ms lkely hdden sae sequence Learnng Gven an bservan sequence and se f pssble mdels, whch mdel ms clsely fs he daa? 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 5 L sses Far/Laded L- L O O O O L- OL Head/al Query: wha are he ms lkely values n he -ndes generae he gven daa? 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 6 Prbably f an Observan Sequence Prbably f an bservan sequence - + - + Gven an bservan sequence and a mdel, cmpue he prbably f he bservan sequence O (,..., ), µ (,, Π) Cmpue O µ ) 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 7 P... b ( O, µ ) b b - + µ ) π a a... a 3 P ( O, µ ) O, µ ) µ ) P ( O µ ) O, µ ) µ ) 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar Prbably f an Observan Sequence Prbably f an bservan sequence - + - + - + - + O µ ) π b Π a b + + + {... } 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar Specal srucure gves us an effcen slun usng dynamc prgrammng. Inun Prbably f he frs bservans s he same fr all pssble + lengh sae sequences. Defne: α ( )..., µ ) 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 30
Frward Prcedure Frward Prcedure - + - + - + α ( +) P (... P (... P (... P (..., - + + +, + + + + ) ) P ( ) P ( ) P ( + + + ) + + ) P ( ) 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 3 + )... N... N... N... N...,,..., + + +..., ) α ( ) a b ) + + + ) ) ) ) + + + + ) ) 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 3 ackward Prcedure Sequence prbably - + - + β ( + ) - + β ( )... ) β ( ) a b β ( + )... N 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 33 Prbably f he res f he saes gven he frs sae N O µ ) α ( ) N N - + O µ ) π β () O µ ) α ( ) β ( ) Frward Prcedure ackward Prcedure Cmbnan 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 34 he ms prbable Sae Sequence Verb lgrhm - - + - + Fnd he sae sequence ha bes eplans he bservans Verb algrhm argma O) 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 35 δ ( ) ma...,...,..., ) he sae sequence whch mamzes he prbably f seeng he bservans me -, landng n sae, and seeng he bservan a me 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 36
Verb lgrhm Verb lgrhm - + - + - + - + δ ( ) ma...,..., δ... ( + ) maδ ( ) ab +, ) ψ ( + ) arg maδ ( ) ab + 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 37 Recursve Cmpuan ˆ ˆ arg maδ ( ) ψ ( ) ^ + + ˆ ) arg maδ ( ) Cmpue he ms lkely sae sequence by wrkng backwards 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 3 Learnng HMM Parameer Esman Parameer Esman: aum-welch r Frward- ackward - + Gven an bservan sequence, fnd he mdel ha s ms lkely prduce ha sequence. Gven a mdel and bservan sequence, updae he mdel parameers beer f he bservans. 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 3 p - + α ( ) ab β ( + ) α ( ) β ( ) + (, ) m m... N γ ( ) m p (, )... N beng n sae 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 40 Prbably f raversng an arc Prbably f aˆ Parameer Esman: aum-welch lgrhm ˆ p (, ) γ ( ) γ ( ) - + { : k } bk 4/0/003 Cm γ S 573 Machne Learnng Sprng 003. Cpyrgh mdel Vasan parameers. ( ) Hnavar 4 π ˆ γ () Nw we can cmpue he new esmaes f he HMM Parameer esman n pracce Sparseness f daa requres Smhng (as n Naïve ayes) gve suable nnzer prbably unseen bservans Dman specfc rcks Feaure decmpsn (capalzed?, number?, ec. n e prcessng) gves a beer esmae Shrnkage allws plng f esmaes ver mulple saes f same ype Well desgned (r learned) HMM plgy 4/0/003 Cm S 573 Machne Learnng Sprng 003. Cpyrgh Vasan Hnavar 4