1Eric Xing 1Machine LearningMachine Learning1010--701/15701/15--781, Fall 2008781, Fall 2008Hidden Markov ModelHidden Markov ModelEric XingEric XingLecture 17, March 24, 2008Reading: Chap. 13, C.B bookEric Xing 22Eric Xing 3Hidden Markov Model: from static to dynamic mixture modelsDynamic mixtureDynamic mixtureA AA AX2X3X1XTY2Y3Y1YT... ... Static mixtureStatic mixtureAX1Y1NEric Xing 4A AA AX2X3X1XTY2Y3Y1YT... ... The sequence:The underlying source:Ploy NT, genomic entities, sequence of rolls, dice,Hidden Markov Models3Eric Xing 5Example: The Dishonest CasinoA casino has two dice:z Fair dieP(1) = P(2) = P(3) = P(5) = P(6) = 1/6z Loaded dieP(1) = P(2) = P(3) = P(5) = 1/10P(6) = 1/2Casino player switches back-&-forth between fair and loaded die once every 20 turnsGame:1. You bet $12. You roll (always with a fair die)3. Casino player rolls (maybe with fair die, maybe with loaded die)4. Highest number wins $2Eric Xing 6Puzzles Regarding the Dishonest Casino GIVEN: A sequence of rolls by the casino player1245526462146146136136661664661636616366163616515615115146123562344QUESTIONz How likely is this sequence, given our model of how the casino works?z This is the EVALUATION problem in HMMszWhat portion of the sequence was generated with the fair die, and what portion with the loaded die?z This is the DECODING question in HMMszHow “loaded” is the loaded die? How “fair” is the fair die? How often does the casino player change from fair to loaded, and back?z This is the LEARNING question in HMMs4Eric Xing 7A Stochastic Generative Modelz Observed sequence:z Hidden sequence (a parse or segmentation):AB14 3 66 4BA A ABBEric Xing 8Definition (of HMM)zObservation spaceObservation spaceAlphabetic set:Euclidean space:zIndex set of hidden statesIndex set of hidden stateszTransition probabilitiesTransition probabilitiesbetween any two statesbetween any two statesorzStart probabilitiesStart probabilitieszEmission probabilitiesEmission probabilitiesassociated with each stateassociated with each stateor in general:A AA Ax2x3x1xTy2y3y1yT... ... {}Kccc,,, L21=CdR{}M,,, L21=I,)|(,jiitjtayyp===−111().,,,,lMultinomia~)|(,,,I∈∀=−iaaayypMiiiittK2111().,,,lMultinomia~)(MypπππK211().,,,,lMultinomia~)|(,,,I∈∀=ibbbyxpKiiiittK211().,|f~)|( I∈∀⋅=iyxpiittθ1Graphical modelK1…2State automata5Eric Xing 9Joint ProbabilityEric Xing 10Probability of a Parsez Given a sequence x = x1……xTand a parse y = y1, ……, yT,z To find how likely is the parse:(given our HMM and the sequence)p(x, y) = p(x1……xT, y1, ……, yT) (Joint probability)=p(y1) p(x1| y1)p(y2| y1) p(x2| y2) …p(yT| yT-1) p(xT| yT)= p(y1) P(y2| y1) …p(yT| yT-1) ×p(x1| y1)p(x2| y2)…p(xT| yT)= p(y1, ……, yT) p(x1……xT| y1, ……, yT)=z Marginal probability:z Posterior probability:[],,def,jtitttyyMjiijyyaa111++∏==[],defiyMiiy111∏==ππ[], anddef,ktitttxyMiKkikxybb∏∏===11LetTTyyyyyaa,,1211 −LπTTxyxybb,,L11∑∑∑∑∏∏==−==yyxx121121yy yTtTtttyyyNttyxpapp)|(),()(,πL)(/),()|( xyxxyppp=A AA Ax2x3x1xTy2y3y1yT... ...6Eric Xing 11FAIR LOADED0.050.050.950.95P(1|F) = 1/6P(2|F) = 1/6P(3|F) = 1/6P(4|F) = 1/6P(5|F) = 1/6P(6|F) = 1/6P(1|L) = 1/10P(2|L) = 1/10P(3|L) = 1/10P(4|L) = 1/10P(5|L) = 1/10P(6|L) = 1/2The Dishonest Casino ModelEric Xing 12Example: the Dishonest Casinoz Let the sequence of rolls be:zx= 1, 2, 1, 5, 6, 2, 1, 6, 2, 4z Then, what is the likelihood ofzy= Fair, Fair, Fair, Fair, Fair, Fair, Fair, Fair, Fair, Fair?(say initial probs a0Fair= ½, aoLoaded= ½)½ × P(1 | Fair) P(Fair | Fair) P(2 | Fair) P(Fair | Fair) … P(4 | Fair) =½ × (1/6)10× (0.95)9= .00000000521158647211 = 5.21 × 10-97Eric Xing 13Example: the Dishonest Casinoz So, the likelihood the die is fair in all this runis just 5.21 × 10-9z OK, but what is the likelihood ofz π = Loaded, Loaded, Loaded, Loaded, Loaded, Loaded, Loaded, Loaded, Loaded, Loaded?½ × P(1 | Loaded) P(Loaded | Loaded) … P(4 | Loaded) =½ × (1/10)8× (1/2)2(0.95)9= .00000000078781176215 = 0.79 × 10-9z Therefore, it is after all 6.59 times more likely that the die is fair all the way, than that it is loaded all the wayEric Xing 14Example: the Dishonest Casinoz Let the sequence of rolls be:zx= 1, 6, 6, 5, 6, 2, 6, 6, 3, 6z Now, what is the likelihood π = F, F, …, F?z ½ × (1/6)10× (0.95)9= 0.5 × 10-9, same as beforez What is the likelihood y= L, L, …, L?½ × (1/10)4× (1/2)6(0.95)9= .00000049238235134735 = 5 × 10-7z So, it is 100 times more likely the die is loaded8Eric Xing 15Three Main Questions on HMMs1.1.EvaluationEvaluationGIVEN an HMM M, and a sequence x,FIND Prob (x| M)ALGO.ForwardForward2.2.DecodingDecodingGIVEN an HMM M, and a sequence x,FIND the sequence y of states that maximizes, e.g., P(y| x, M), or the most probable subsequence of statesALGO.ViterbiViterbi, Forward, Forward--backward backward 3.3.LearningLearningGIVEN an HMM M, with unspecified transition/emission probs.,and a sequence x,FIND parameters θ = (πi, aij, ηik) that maximize P(x| θ)ALGO.BaumBaum--Welch (EM)Welch (EM)Eric Xing 16Applications of HMMsz Some early applications of HMMsz finance, but we never saw them z speech recognition z modelling ion channels z In the mid-late 1980s HMMs entered genetics and molecular biology, and they are now firmly entrenched.z Some current applications of HMMs to biologyz mapping chromosomesz aligning biological sequencesz predicting sequence structurez inferring evolutionary relationshipsz finding genes in DNA sequence9Eric Xing 17Typical structure of a geneEric Xing 18E0E1E2Epoly-A3'UTR5'UTRtEiEsI0I1I2intergenicregionForward (+) strandReverse (-) strandForward (+) strandReverse (-)
View Full Document