{"id":821,"date":"2019-01-09T08:56:17","date_gmt":"2019-01-09T08:56:17","guid":{"rendered":"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/?post_type=chapter&#038;p=821"},"modified":"2019-01-09T09:14:03","modified_gmt":"2019-01-09T09:14:03","slug":"hmm-em-algorithm","status":"publish","type":"chapter","link":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/chapter\/hmm-em-algorithm\/","title":{"rendered":"HMM \u2013 EM Algorithm"},"content":{"raw":"<div><span style=\"float: right\"><a href=\"https:\/\/youtu.be\/ib13-wwItjU\" target=\"_blank\" rel=\"noopener\"><img src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"epgp books\" width=\"75px\" height=\"75px;\" \/><\/a>\r\n<\/span><\/div>\r\n\r\n<div>\r\n\r\n&nbsp;\r\n\r\n<strong>Learning Objectives:<\/strong>\r\n\r\n&nbsp;\r\n\r\nThe learning objectives of this module are as follows:\r\n\r\n&nbsp;\r\n\r\n\u2022\u00a0\u00a0\u00a0\u00a0\u00a0 To understand the concept of Model Learning in HMM\r\n\r\n&nbsp;\r\n\r\n\u2022\u00a0\u00a0\u00a0\u00a0\u00a0 To discuss the Expectation Maximization method for parameter estimation\r\n\r\n&nbsp;\r\n\r\n\u2022\u00a0\u00a0\u00a0\u00a0\u00a0 To understand parameter estimation using supervised and unsupervised techniques\r\n\r\n&nbsp;\r\n\r\n<strong>36.1 Recap: Hidden Markov Model<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">As we have already discussed a Hidden Markov Model is an extension of a Markov model in which the input symbols are not the same as the states.This means we don\u2019t know which state we are in (hence called Hidden State). For example in HMM POS-tagging, the input symbols are the words, states are the part of speech tags. In addition we make two impittant and the sattes<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\"><strong>Markov assumption <\/strong>states that the state transition depends only on the origin and destination and the <strong>Output-independent assumption<\/strong> which s all observation frames are dependent on the state that generated them, not on neighbouring observation frames .<\/p>\r\n&nbsp;\r\n\r\n<strong>36.1.1 The Three Problems of HMM<\/strong>\r\n\r\n&nbsp;\r\n\r\nThe following are the three problems associated with HMM:\r\n\r\n&nbsp;\r\n\r\n<strong>Problem 1: Evaluation<\/strong>\r\n\r\n&nbsp;\r\n\r\nHere given the observation sequence <em>O=o<\/em><em>1<\/em><em>,\u2026,o<\/em><em>T<\/em>and an HMM model how do we compute the probability of O given the model?\r\n\r\n&nbsp;\r\n\r\n<strong style=\"text-align: initial;font-size: 1em\">Q1<\/strong><span style=\"text-align: initial;font-size: 1em\">:<\/span><strong style=\"text-align: initial;font-size: 1em\"> How do we compute the probability of a given sequence of observations?<\/strong>\r\n\r\n&nbsp;\r\n\r\n<strong style=\"text-align: initial;font-size: 1em\">A1: <\/strong><span style=\"text-align: initial;font-size: 1em\">Forward \u2013 Backward dynamic programming algorithm \u2013<\/span><strong style=\"text-align: initial;font-size: 1em\"> the Baum Welch algorithm<\/strong>\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n\r\n<strong>Problem 2: Decoding<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Here given the observation sequence <em>O=o<\/em><em>1<\/em><em>,\u2026,o<\/em><em>T<\/em>and an HMM model, how do we find the state sequence that best explains the observations?<\/p>\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n\r\n<strong>Q2:How to compute the most probable sequence of sequence of observations?\u00a0<\/strong><strong>states, given a<\/strong>\r\n\r\n&nbsp;\r\n\r\n<strong style=\"text-align: initial;font-size: 1em\">A2: Viterbi\u2019s <\/strong><span style=\"text-align: initial;font-size: 1em\">dynamic programming Algorithm<\/span>\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n\r\nGiven an observation sequence, compute the most likely hidden state sequence\r\n\r\n&nbsp;\r\n\r\nWe have already the solutions to the above two problems in the previous module.\r\n\r\n&nbsp;\r\n\r\nProblem 3 \u2013 Learning \u2013 this is the problem we will be now discussing\r\n\r\n&nbsp;\r\n\r\n<strong>36.2 Problem 3: Learning<\/strong>\r\n\r\n&nbsp;\r\n\r\nGiven an observation sequence and set of possible models, which model most\r\n\r\n&nbsp;\r\n\r\nclosely\u00a0\u00a0 fits\u00a0\u00a0\u00a0 the\u00a0\u00a0 data?How\u00a0\u00a0\u00a0 do\u00a0\u00a0 we\u00a0\u00a0 adjust\u00a0\u00a0 the\u00a0\u00a0 model\u00a0\u00a0\u00a0 parameters\r\n\r\n<img class=\"aligncenter size-full wp-image-825\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-236.png\" alt=\"\" width=\"207\" height=\"45\" \/>\r\n\r\n&nbsp;\r\n\r\nto maximize\r\n\r\n<img class=\"aligncenter size-full wp-image-826\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-237.png\" alt=\"\" width=\"148\" height=\"51\" \/>\r\n\r\n<strong>Q3: Given an observation sequence and set of possible models, which model most closely fits the data?<\/strong>\r\n\r\n&nbsp;\r\n\r\n<strong>A3: The Expectation Maximization (EM) heuristic.<\/strong>\r\n\r\n&nbsp;\r\n\r\nIt is this learning problem that we will be discussing in this module. This is the hardest problem to solve.\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Given an observation sequence O = (O1 O2 \u2026 OL), and a class of models, each of the form M = {A,B,p}, which specific model \u201cbest\u201d explains the observations?A solution to the above question enablesthe efficient computation of P(O|M) (the probability that a specific model M produces the observation O). This can be viewed as a learning problem: We want to use the sequence of\u00a0<span style=\"font-size: 1em;text-align: initial\">observations in order to \u201ctrain\u201d an HMM and learn the optimal underlying model parameters essentially we are learning the transition and observation probabilities.<\/span><\/p>\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">In other words we need to estimate the emission and transition probabilities given observations and assuming that hidden states are observable during the learning process. We need to estimate emission and transition probabilities given observations only.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">Up to now we\u2019ve assumed that we know the underlying model. However often these parameters are estimated on annotated training data, which gives rise to two drawbacks, basically annotation is difficult and\/or expensive and training data is different from the current data. We want to maximize the parameters with respect to the current data, i.e., we\u2019re looking for a model l\u2019, such that<\/p>\r\n&nbsp;\r\n\r\n<img class=\"aligncenter size-full wp-image-827\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-238.png\" alt=\"\" width=\"323\" height=\"76\" \/>\r\n\r\n<strong>36.3 Parameter Estimation<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">We first make an initial guess for the transition probabilities {aij} and observation or emission probabilities {bkm}. We need to then compute the probability that one hidden state follows another given the guessed values of {aij} and {bkm} and sequence of observations which are computed using forward-backward algorithm. We then compute the probability of observed state given a hidden state and the guessed values of {aij} and {bkm} and the sequence of observations again computed using the forward-backward algorithm. Now using these computed probabilities we make an improved guess for the transition and observation probabilities {aij} and {bkm}. We then repeat this process until convergence. It can be shown that this algorithm does in fact converge to correct values for {aij} and {bkm} assuming that the initial guess was close enough.<\/p>\r\n&nbsp;\r\n\r\nThat is given an observation sequence, find the model that is most likely to produce that sequence. Here we use no analytic method. We just assume a model and given a model and observation sequence, we update the model parameters to better fit the observations.\r\n\r\n<strong>36.3 Review of Probabilities<\/strong>\r\n\r\n&nbsp;\r\n\r\nLet us now review the different probabilities that we have discussed in connection with HMM.\r\n\r\n<\/div>\r\n<div>\r\n\r\n<img class=\"aligncenter size-full wp-image-828\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-239.png\" alt=\"\" width=\"536\" height=\"93\" \/>\r\n\r\n<img class=\"aligncenter size-full wp-image-829\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-240.png\" alt=\"\" width=\"607\" height=\"344\" \/>\r\n\r\n&nbsp;\r\n\r\n<strong>36.4 Parameter Estimation<\/strong>\r\n\r\n&nbsp;\r\n\r\nThe probability of moving from one state to another:\r\n\r\n<img class=\"aligncenter size-full wp-image-830\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-241.png\" alt=\"\" width=\"471\" height=\"123\" \/>\r\n\r\nand the probability of being in state i\r\n\r\n<img class=\"aligncenter size-full wp-image-831\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-242.png\" alt=\"\" width=\"417\" height=\"112\" \/>\r\n\r\nWith the above probabilities we can recalculate the initial probability, and the transition and emission probabilities.\r\n\r\n<\/div>\r\n<div>\r\n\r\n<img class=\"aligncenter size-full wp-image-832\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-243.png\" alt=\"\" width=\"538\" height=\"291\" \/>\r\n\r\n<strong>36.5 Expectation Maximization<\/strong>\r\n\r\n&nbsp;\r\n\r\nThe forward-backward algorithm is an instance of the more general EM algorithm where\r\n\r\n&nbsp;\r\n\r\n\u2022\u00a0\u00a0\u00a0\u00a0\u00a0 The E Step: where we compute the forward and backward probabilities for a given model\r\n\r\n&nbsp;\r\n\r\n\u2022\u00a0\u00a0\u00a0\u00a0\u00a0 The M Step where we re-estimate the model parameters\r\n\r\n&nbsp;\r\n\r\nUse the forward-backward (or Baum-Welch) algorithm, which is a hill-climbing algorithm\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Using an initial parameter instantiation, the forward-backward algorithm iteratively re-estimates the parameters and improves the probability that given observations are generated by the new parameters.Three parameters need to be re-estimated:<\/p>\r\n&nbsp;\r\n\r\n\u2013\u00a0 Initial state distribution:\r\n\r\n&nbsp;\r\n\r\n\u2013\u00a0 Transition probabilities: ai, j\r\n\r\n&nbsp;\r\n\r\n\u2013\u00a0 Emission probabilities: bi(ot)\r\n\r\n&nbsp;\r\n\r\n<strong>Re-estimating Transition Probabilities<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Here we need to determine the probability of being in state s i at time t and going to state sj, given the current model and parameters as follows:<\/p>\r\n<img class=\"aligncenter size-full wp-image-833\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-244.png\" alt=\"\" width=\"557\" height=\"52\" \/>\r\n\r\nNow we can calculate the probability as given in Figure 36.2.\r\n\r\n<\/div>\r\n<div>\r\n\r\n<img class=\"aligncenter size-full wp-image-834\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-245.png\" alt=\"\" width=\"591\" height=\"417\" \/>\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Here the probability is based on previous values of initial, transition and emission probabilities.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">In other words <strong>the probability<\/strong> <strong>x<\/strong><strong>t<\/strong> <strong>(i,j)<\/strong> <strong>between the states i, j at time slice t i<\/strong>s the ratio of the product of the forward probability of state i at time slice t,<\/p>\r\n<p style=\"text-align: justify\">the transition probability between states i and j,<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">the emission probability of observation symbol ot+1at time slice t+1, at state j, and the backward probability of state j at time slice t+1 and<\/p>\r\n&nbsp;\r\n\r\nthe sum of the products of the terms explained above considered for all N values of i and j.\r\n\r\n<img class=\"aligncenter size-full wp-image-835\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-246.png\" alt=\"\" width=\"580\" height=\"261\" \/>\r\n\r\nDefining\r\n\r\n<\/div>\r\n<div>\r\n\r\n<img class=\"aligncenter size-full wp-image-836\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-247.png\" alt=\"\" width=\"542\" height=\"341\" \/>\r\n\r\n&nbsp;\r\n\r\n<strong>Re-estimating Initial State Probabilities<\/strong>\r\n\r\n&nbsp;\r\n\r\n<img class=\"aligncenter size-full wp-image-837\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-248.png\" alt=\"\" width=\"463\" height=\"190\" \/>\r\n\r\n&nbsp;\r\n\r\n<strong>36.6 Explaining EM algorithm with an Example<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">First let us consider a document corpus as an example. The problem we are trying to solve is tagging of the words of a sentence. An example of such a tagging problem is the Part of Speech (POS) tagging where each word in the sentence is tagged with a POS.<\/p>\r\n&nbsp;\r\n\r\nExample The man eats the sweet mango.\r\n\r\n&nbsp;\r\n\r\nDet Noun\u00a0 Vrb Det\u00a0\u00a0\u00a0\u00a0 ADJ\u00a0\u00a0\u00a0\u00a0 Noun\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">In the POS tagging problem we want to find the tag sequence t1\u2026tnwith the highest probabilityof the word sequencew1\u2026wn. Here we need to estimate probabilities. Here we need to determine transition probability, emission probability, carry out some type of smoothing since we need to deal with unknown words. The transition probability P(ti|ti-1)is the probability of tag t i following tagti-1. The emission probability is the probability of a tag emitting a particular word.<\/p>\r\n&nbsp;\r\n\r\nThe general idea is as follows:\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Start by devising a noisy channel, any model predicts the corpus observations via some hidden structure (tags, parses, \u2026). Initially a guess is made about the\u00a0<span style=\"font-size: 1em;text-align: initial\">parameters of the model. It is best to make an educated guess but a random guess can also work.<\/span><\/p>\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n\r\nAs in any EM algorithm we repeat the following two steps until convergence:\r\n\r\n&nbsp;\r\n\r\n\u2022\u00a0\u00a0\u00a0\u00a0\u00a0 <strong>Expectation step: <\/strong>Use current parameters (and observations) to reconstruct hidden structure\r\n\r\n&nbsp;\r\n\r\n\u2022\u00a0\u00a0\u00a0\u00a0\u00a0 <strong>Maximization step: <\/strong>Use that hidden structure (and observations) to re-estimate parameters\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Now let us go back to our HMM problem. We want to find out of from all the possible sequences of n tags t1\u2026tn, the single tag sequence such that P(t1\u2026tn|w1\u2026wn) is highest.<\/p>\r\n<img class=\"aligncenter size-full wp-image-838\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-249.png\" alt=\"\" width=\"411\" height=\"84\" \/>\r\n\r\nHat ^ means \u201cour estimate of the best one\u201d and Argmaxx f(x) means \u201cthe x such that f(x) is maximized\u201d.\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">This equation is guaranteed to give us the best tag sequence . But how to make it operational? How to compute this value? We use the intuition of Bayesian classification where we use Bayes rule to transform into a set of other probabilities that are easier to compute as follows:<\/p>\r\n<img class=\"aligncenter size-full wp-image-839\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-250.png\" alt=\"\" width=\"357\" height=\"185\" \/>\r\n\r\nNow we would like to define likelihood and prior as follows:\r\n\r\n<\/div>\r\n<div>\r\n\r\n<img class=\"aligncenter size-full wp-image-840\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-251.png\" alt=\"\" width=\"568\" height=\"289\" \/>\r\n<p style=\"text-align: justify\">Therefore we find the best tag sequence (POS sequence) for a given sequence of words as the sequence that gives the maximum probability of the product of likelihood (emission probability) and prior (transition probability). Here we assumed we had an already tagged corpus from which we could estimate the required probabilities.<\/p>\r\n&nbsp;\r\n\r\n<strong>36.7 Estimation from Untagged Corpus: EM \u2013 Expectation-Maximization<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">When we use a plain-text corpus and a lexicon to obtain transition and emission probabilities by applying the EM algorithm. The steps are:<\/p>\r\n&nbsp;\r\n\r\n1.Start with some initial model\r\n\r\n&nbsp;\r\n\r\n2. Compute the probability of (virtually) each state sequence given the current model\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">3. Use this probabilistic tagging to produce probabilistic counts for all parameters, and use these probabilistic counts to estimate a revised model, which increases the likelihood of the observed output W in each iteration<\/p>\r\n&nbsp;\r\n\r\n4.\u00a0\u00a0\u00a0 Repeat until convergence\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\"><strong><em>No <\/em><\/strong><em>labeled training required. Initialize by lexicon constraints regarding possible POS for each word (cf. \u201cnoisy counting\u201d for PP\u2019s) . In other words we cannot calculate transition probabilities but do have values of emission probabilities. Therefore we start with some random values for the transition probabilities and continue until no improvement occurs.<\/em><\/p>\r\n&nbsp;\r\n\r\nThe EM algorithm is as follows:\r\n<ul>\r\n \t<li>Choose initial model = &lt;<strong>a,b,g<\/strong>(1)&gt;<\/li>\r\n \t<li><span style=\"text-align: initial;font-size: 1em\">Repeat until results don\u2019t improve (much):<\/span><\/li>\r\n \t<li><span style=\"text-align: initial;font-size: 1em\">Compute pk based on current model, using Forward &amp; Backwards algorithms to compute A and B (Expectation for counts)<\/span><\/li>\r\n \t<li><span style=\"text-align: initial;font-size: 1em\">Compute new model &lt;<\/span><strong style=\"text-align: initial;font-size: 1em\">a\u2019<\/strong><span style=\"text-align: initial;font-size: 1em\">,<\/span><strong style=\"text-align: initial;font-size: 1em\">b\u2019<\/strong><span style=\"text-align: initial;font-size: 1em\">,<\/span><strong style=\"text-align: initial;font-size: 1em\">g<\/strong><span style=\"text-align: initial;font-size: 1em\">\u2019(1)&gt; (Maximization of parameters)<\/span><\/li>\r\n<\/ul>\r\n<span style=\"text-align: initial;font-size: 1em\">Note: Output likelihood is guaranteed to increase in each iteration, but might converge to a <\/span><em style=\"text-align: initial;font-size: 1em\">local<\/em><span style=\"text-align: initial;font-size: 1em\"> maximum<\/span>\r\n\r\n<\/div>\r\n&nbsp;\r\n\r\n<strong>Summary<\/strong>\r\n<ul>\r\n \t<li>Explained the concept of Model Learning in HMM<\/li>\r\n \t<li>Discussed Expectation Maximization method for HMM parameter estimation<\/li>\r\n \t<li>Explained parameter estimation using unsupervised techniques<\/li>\r\n<\/ul>\r\n&nbsp;\r\n\r\n<strong>Web Links<\/strong>\r\n<ul>\r\n \t<li>studentnet.cs.manchester.ac.uk\/ugt\/COMP24111\/...\/Nai ve-Bayes.ppt<\/li>\r\n \t<li>web.cecs.pdx.edu\/...\/2015BayesTrees...\/2014_0095_Example%20of%20<\/li>\r\n \t<li>https:\/\/cse.sc.edu\/~rose\/587\/PPT\/NaiveBayes.ppt<\/li>\r\n \t<li>www.cs.unc.edu\/~lazebnik\/spring09\/lec20_generative.ppt<\/li>\r\n \t<li>cis-linux1.temple.edu\/~latecki\/Courses\/RobotFall08\/...\/bayesNaive.ppt<\/li>\r\n \t<li>www.cs.bu.edu\/fac\/gkollios\/ada01\/LectNotes\/Bayesian.ppt<\/li>\r\n<\/ul>\r\n&nbsp;\r\n<table>\r\n<tbody>\r\n<tr>\r\n<td><strong>you can view video on HMM \u2013EM Algorithm<\/strong><\/td>\r\n<td><a href=\"https:\/\/youtu.be\/ib13-wwItjU\" target=\"_blank\" rel=\"noopener\"><img class=\"alignnone wp-image-120\" src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"\" width=\"36\" height=\"36\" \/><\/a><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n\r\n<strong>Supporting &amp; Reference Materials<\/strong>\r\n<ul>\r\n \t<li>Tom <a href=\"http:\/\/www.amazon.in\/s\/ref=dp_byline_sr_book_1?ie=UTF8&amp;field-author=Mitchell&amp;search-alias=stripbooks\">Mitchell, <\/a>\u201cMachine Learning\u201d,McGraw-Hill Education, 1997<\/li>\r\n \t<li><a href=\"http:\/\/www.amazon.in\/s\/ref=dp_byline_sr_book_1?ie=UTF8&amp;field-author=Alpaydin+Ethem&amp;search-alias=stripbooks\">AlpaydinEthem, <\/a>\u201cIntroduction to Machine Learning\u201d, The MIT Press; third edition, 2014<\/li>\r\n \t<li>Christopher M. <a href=\"http:\/\/www.amazon.in\/s\/ref=dp_byline_sr_book_1?ie=UTF8&amp;field-author=Bishop&amp;search-alias=stripbooks\">Bishop, <\/a>\u201cPattern Recognition and Machine Learning\u201d,Springer, 2013 <a href=\"http:\/\/www.amazon.in\/s\/ref=dp_byline_sr_book_1?ie=UTF8&amp;field-author=Peter+Harrington&amp;search-alias=stripbooks\">Peter Harrington, <\/a>\u201cMachine Learning In Action\u201d, Manning Publications, 2012<\/li>\r\n \t<li><a href=\"http:\/\/www.amazon.in\/s\/ref=dp_byline_sr_book_1?ie=UTF8&amp;field-author=Peter+Flach&amp;search-alias=stripbooks\">Peter Flach, <\/a>\u201cMachine Learning: The Art and Science of Algorithms that Make Sense of Data\u201d,Cambridge University Press, 2012<\/li>\r\n \t<li><a href=\"http:\/\/www.amazon.in\/s\/ref=dp_byline_sr_book_1?ie=UTF8&amp;field-author=Stephen+Marsland&amp;search-alias=stripbooks\">Stephen Marsland, <\/a>\u201cMachine Learning: An Algorithmic Perspective\u201d, Chapman and Hall\/CRC; 2 edition, 2014<\/li>\r\n \t<li>Abu-Mostafa, M. Magdon-Ismail, and H.-T. Lin, \u201cLearning from Data\u201d, AMLBook, 2012.<\/li>\r\n<\/ul>","rendered":"<div><span style=\"float: right\"><a href=\"https:\/\/youtu.be\/ib13-wwItjU\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"epgp books\" width=\"75px\" height=\"75px;\" \/><\/a><br \/>\n<\/span><\/div>\n<div>\n<p>&nbsp;<\/p>\n<p><strong>Learning Objectives:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>The learning objectives of this module are as follows:<\/p>\n<p>&nbsp;<\/p>\n<p>\u2022\u00a0\u00a0\u00a0\u00a0\u00a0 To understand the concept of Model Learning in HMM<\/p>\n<p>&nbsp;<\/p>\n<p>\u2022\u00a0\u00a0\u00a0\u00a0\u00a0 To discuss the Expectation Maximization method for parameter estimation<\/p>\n<p>&nbsp;<\/p>\n<p>\u2022\u00a0\u00a0\u00a0\u00a0\u00a0 To understand parameter estimation using supervised and unsupervised techniques<\/p>\n<p>&nbsp;<\/p>\n<p><strong>36.1 Recap: Hidden Markov Model<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">As we have already discussed a Hidden Markov Model is an extension of a Markov model in which the input symbols are not the same as the states.This means we don\u2019t know which state we are in (hence called Hidden State). For example in HMM POS-tagging, the input symbols are the words, states are the part of speech tags. In addition we make two impittant and the sattes<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><strong>Markov assumption <\/strong>states that the state transition depends only on the origin and destination and the <strong>Output-independent assumption<\/strong> which s all observation frames are dependent on the state that generated them, not on neighbouring observation frames .<\/p>\n<p>&nbsp;<\/p>\n<p><strong>36.1.1 The Three Problems of HMM<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>The following are the three problems associated with HMM:<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Problem 1: Evaluation<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Here given the observation sequence <em>O=o<\/em><em>1<\/em><em>,\u2026,o<\/em><em>T<\/em>and an HMM model how do we compute the probability of O given the model?<\/p>\n<p>&nbsp;<\/p>\n<p><strong style=\"text-align: initial;font-size: 1em\">Q1<\/strong><span style=\"text-align: initial;font-size: 1em\">:<\/span><strong style=\"text-align: initial;font-size: 1em\"> How do we compute the probability of a given sequence of observations?<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><strong style=\"text-align: initial;font-size: 1em\">A1: <\/strong><span style=\"text-align: initial;font-size: 1em\">Forward \u2013 Backward dynamic programming algorithm \u2013<\/span><strong style=\"text-align: initial;font-size: 1em\"> the Baum Welch algorithm<\/strong><\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p><strong>Problem 2: Decoding<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Here given the observation sequence <em>O=o<\/em><em>1<\/em><em>,\u2026,o<\/em><em>T<\/em>and an HMM model, how do we find the state sequence that best explains the observations?<\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p><strong>Q2:How to compute the most probable sequence of sequence of observations?\u00a0<\/strong><strong>states, given a<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><strong style=\"text-align: initial;font-size: 1em\">A2: Viterbi\u2019s <\/strong><span style=\"text-align: initial;font-size: 1em\">dynamic programming Algorithm<\/span><\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p>Given an observation sequence, compute the most likely hidden state sequence<\/p>\n<p>&nbsp;<\/p>\n<p>We have already the solutions to the above two problems in the previous module.<\/p>\n<p>&nbsp;<\/p>\n<p>Problem 3 \u2013 Learning \u2013 this is the problem we will be now discussing<\/p>\n<p>&nbsp;<\/p>\n<p><strong>36.2 Problem 3: Learning<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Given an observation sequence and set of possible models, which model most<\/p>\n<p>&nbsp;<\/p>\n<p>closely\u00a0\u00a0 fits\u00a0\u00a0\u00a0 the\u00a0\u00a0 data?How\u00a0\u00a0\u00a0 do\u00a0\u00a0 we\u00a0\u00a0 adjust\u00a0\u00a0 the\u00a0\u00a0 model\u00a0\u00a0\u00a0 parameters<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-825\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-236.png\" alt=\"\" width=\"207\" height=\"45\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-236.png 207w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-236-65x14.png 65w\" sizes=\"auto, (max-width: 207px) 100vw, 207px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>to maximize<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-826\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-237.png\" alt=\"\" width=\"148\" height=\"51\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-237.png 148w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-237-65x22.png 65w\" sizes=\"auto, (max-width: 148px) 100vw, 148px\" \/><\/p>\n<p><strong>Q3: Given an observation sequence and set of possible models, which model most closely fits the data?<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><strong>A3: The Expectation Maximization (EM) heuristic.<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>It is this learning problem that we will be discussing in this module. This is the hardest problem to solve.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Given an observation sequence O = (O1 O2 \u2026 OL), and a class of models, each of the form M = {A,B,p}, which specific model \u201cbest\u201d explains the observations?A solution to the above question enablesthe efficient computation of P(O|M) (the probability that a specific model M produces the observation O). This can be viewed as a learning problem: We want to use the sequence of\u00a0<span style=\"font-size: 1em;text-align: initial\">observations in order to \u201ctrain\u201d an HMM and learn the optimal underlying model parameters essentially we are learning the transition and observation probabilities.<\/span><\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">In other words we need to estimate the emission and transition probabilities given observations and assuming that hidden states are observable during the learning process. We need to estimate emission and transition probabilities given observations only.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Up to now we\u2019ve assumed that we know the underlying model. However often these parameters are estimated on annotated training data, which gives rise to two drawbacks, basically annotation is difficult and\/or expensive and training data is different from the current data. We want to maximize the parameters with respect to the current data, i.e., we\u2019re looking for a model l\u2019, such that<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-827\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-238.png\" alt=\"\" width=\"323\" height=\"76\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-238.png 323w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-238-300x71.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-238-65x15.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-238-225x53.png 225w\" sizes=\"auto, (max-width: 323px) 100vw, 323px\" \/><\/p>\n<p><strong>36.3 Parameter Estimation<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">We first make an initial guess for the transition probabilities {aij} and observation or emission probabilities {bkm}. We need to then compute the probability that one hidden state follows another given the guessed values of {aij} and {bkm} and sequence of observations which are computed using forward-backward algorithm. We then compute the probability of observed state given a hidden state and the guessed values of {aij} and {bkm} and the sequence of observations again computed using the forward-backward algorithm. Now using these computed probabilities we make an improved guess for the transition and observation probabilities {aij} and {bkm}. We then repeat this process until convergence. It can be shown that this algorithm does in fact converge to correct values for {aij} and {bkm} assuming that the initial guess was close enough.<\/p>\n<p>&nbsp;<\/p>\n<p>That is given an observation sequence, find the model that is most likely to produce that sequence. Here we use no analytic method. We just assume a model and given a model and observation sequence, we update the model parameters to better fit the observations.<\/p>\n<p><strong>36.3 Review of Probabilities<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Let us now review the different probabilities that we have discussed in connection with HMM.<\/p>\n<\/div>\n<div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-828\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-239.png\" alt=\"\" width=\"536\" height=\"93\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-239.png 536w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-239-300x52.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-239-65x11.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-239-225x39.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-239-350x61.png 350w\" sizes=\"auto, (max-width: 536px) 100vw, 536px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-829\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-240.png\" alt=\"\" width=\"607\" height=\"344\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-240.png 607w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-240-300x170.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-240-65x37.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-240-225x128.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-240-350x198.png 350w\" sizes=\"auto, (max-width: 607px) 100vw, 607px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><strong>36.4 Parameter Estimation<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>The probability of moving from one state to another:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-830\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-241.png\" alt=\"\" width=\"471\" height=\"123\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-241.png 471w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-241-300x78.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-241-65x17.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-241-225x59.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-241-350x91.png 350w\" sizes=\"auto, (max-width: 471px) 100vw, 471px\" \/><\/p>\n<p>and the probability of being in state i<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-831\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-242.png\" alt=\"\" width=\"417\" height=\"112\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-242.png 417w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-242-300x81.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-242-65x17.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-242-225x60.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-242-350x94.png 350w\" sizes=\"auto, (max-width: 417px) 100vw, 417px\" \/><\/p>\n<p>With the above probabilities we can recalculate the initial probability, and the transition and emission probabilities.<\/p>\n<\/div>\n<div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-832\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-243.png\" alt=\"\" width=\"538\" height=\"291\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-243.png 538w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-243-300x162.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-243-65x35.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-243-225x122.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-243-350x189.png 350w\" sizes=\"auto, (max-width: 538px) 100vw, 538px\" \/><\/p>\n<p><strong>36.5 Expectation Maximization<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>The forward-backward algorithm is an instance of the more general EM algorithm where<\/p>\n<p>&nbsp;<\/p>\n<p>\u2022\u00a0\u00a0\u00a0\u00a0\u00a0 The E Step: where we compute the forward and backward probabilities for a given model<\/p>\n<p>&nbsp;<\/p>\n<p>\u2022\u00a0\u00a0\u00a0\u00a0\u00a0 The M Step where we re-estimate the model parameters<\/p>\n<p>&nbsp;<\/p>\n<p>Use the forward-backward (or Baum-Welch) algorithm, which is a hill-climbing algorithm<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Using an initial parameter instantiation, the forward-backward algorithm iteratively re-estimates the parameters and improves the probability that given observations are generated by the new parameters.Three parameters need to be re-estimated:<\/p>\n<p>&nbsp;<\/p>\n<p>\u2013\u00a0 Initial state distribution:<\/p>\n<p>&nbsp;<\/p>\n<p>\u2013\u00a0 Transition probabilities: ai, j<\/p>\n<p>&nbsp;<\/p>\n<p>\u2013\u00a0 Emission probabilities: bi(ot)<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Re-estimating Transition Probabilities<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Here we need to determine the probability of being in state s i at time t and going to state sj, given the current model and parameters as follows:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-833\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-244.png\" alt=\"\" width=\"557\" height=\"52\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-244.png 557w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-244-300x28.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-244-65x6.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-244-225x21.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-244-350x33.png 350w\" sizes=\"auto, (max-width: 557px) 100vw, 557px\" \/><\/p>\n<p>Now we can calculate the probability as given in Figure 36.2.<\/p>\n<\/div>\n<div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-834\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-245.png\" alt=\"\" width=\"591\" height=\"417\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-245.png 591w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-245-300x212.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-245-65x46.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-245-225x159.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-245-350x247.png 350w\" sizes=\"auto, (max-width: 591px) 100vw, 591px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Here the probability is based on previous values of initial, transition and emission probabilities.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">In other words <strong>the probability<\/strong> <strong>x<\/strong><strong>t<\/strong> <strong>(i,j)<\/strong> <strong>between the states i, j at time slice t i<\/strong>s the ratio of the product of the forward probability of state i at time slice t,<\/p>\n<p style=\"text-align: justify\">the transition probability between states i and j,<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">the emission probability of observation symbol ot+1at time slice t+1, at state j, and the backward probability of state j at time slice t+1 and<\/p>\n<p>&nbsp;<\/p>\n<p>the sum of the products of the terms explained above considered for all N values of i and j.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-835\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-246.png\" alt=\"\" width=\"580\" height=\"261\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-246.png 580w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-246-300x135.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-246-65x29.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-246-225x101.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-246-350x158.png 350w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/p>\n<p>Defining<\/p>\n<\/div>\n<div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-836\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-247.png\" alt=\"\" width=\"542\" height=\"341\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-247.png 542w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-247-300x189.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-247-65x41.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-247-225x142.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-247-350x220.png 350w\" sizes=\"auto, (max-width: 542px) 100vw, 542px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Re-estimating Initial State Probabilities<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-837\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-248.png\" alt=\"\" width=\"463\" height=\"190\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-248.png 463w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-248-300x123.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-248-65x27.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-248-225x92.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-248-350x144.png 350w\" sizes=\"auto, (max-width: 463px) 100vw, 463px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><strong>36.6 Explaining EM algorithm with an Example<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">First let us consider a document corpus as an example. The problem we are trying to solve is tagging of the words of a sentence. An example of such a tagging problem is the Part of Speech (POS) tagging where each word in the sentence is tagged with a POS.<\/p>\n<p>&nbsp;<\/p>\n<p>Example The man eats the sweet mango.<\/p>\n<p>&nbsp;<\/p>\n<p>Det Noun\u00a0 Vrb Det\u00a0\u00a0\u00a0\u00a0 ADJ\u00a0\u00a0\u00a0\u00a0 Noun<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">In the POS tagging problem we want to find the tag sequence t1\u2026tnwith the highest probabilityof the word sequencew1\u2026wn. Here we need to estimate probabilities. Here we need to determine transition probability, emission probability, carry out some type of smoothing since we need to deal with unknown words. The transition probability P(ti|ti-1)is the probability of tag t i following tagti-1. The emission probability is the probability of a tag emitting a particular word.<\/p>\n<p>&nbsp;<\/p>\n<p>The general idea is as follows:<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Start by devising a noisy channel, any model predicts the corpus observations via some hidden structure (tags, parses, \u2026). Initially a guess is made about the\u00a0<span style=\"font-size: 1em;text-align: initial\">parameters of the model. It is best to make an educated guess but a random guess can also work.<\/span><\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p>As in any EM algorithm we repeat the following two steps until convergence:<\/p>\n<p>&nbsp;<\/p>\n<p>\u2022\u00a0\u00a0\u00a0\u00a0\u00a0 <strong>Expectation step: <\/strong>Use current parameters (and observations) to reconstruct hidden structure<\/p>\n<p>&nbsp;<\/p>\n<p>\u2022\u00a0\u00a0\u00a0\u00a0\u00a0 <strong>Maximization step: <\/strong>Use that hidden structure (and observations) to re-estimate parameters<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Now let us go back to our HMM problem. We want to find out of from all the possible sequences of n tags t1\u2026tn, the single tag sequence such that P(t1\u2026tn|w1\u2026wn) is highest.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-838\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-249.png\" alt=\"\" width=\"411\" height=\"84\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-249.png 411w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-249-300x61.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-249-65x13.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-249-225x46.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-249-350x72.png 350w\" sizes=\"auto, (max-width: 411px) 100vw, 411px\" \/><\/p>\n<p>Hat ^ means \u201cour estimate of the best one\u201d and Argmaxx f(x) means \u201cthe x such that f(x) is maximized\u201d.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">This equation is guaranteed to give us the best tag sequence . But how to make it operational? How to compute this value? We use the intuition of Bayesian classification where we use Bayes rule to transform into a set of other probabilities that are easier to compute as follows:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-839\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-250.png\" alt=\"\" width=\"357\" height=\"185\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-250.png 357w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-250-300x155.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-250-65x34.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-250-225x117.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-250-350x181.png 350w\" sizes=\"auto, (max-width: 357px) 100vw, 357px\" \/><\/p>\n<p>Now we would like to define likelihood and prior as follows:<\/p>\n<\/div>\n<div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-840\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-251.png\" alt=\"\" width=\"568\" height=\"289\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-251.png 568w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-251-300x153.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-251-65x33.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-251-225x114.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-251-350x178.png 350w\" sizes=\"auto, (max-width: 568px) 100vw, 568px\" \/><\/p>\n<p style=\"text-align: justify\">Therefore we find the best tag sequence (POS sequence) for a given sequence of words as the sequence that gives the maximum probability of the product of likelihood (emission probability) and prior (transition probability). Here we assumed we had an already tagged corpus from which we could estimate the required probabilities.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>36.7 Estimation from Untagged Corpus: EM \u2013 Expectation-Maximization<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">When we use a plain-text corpus and a lexicon to obtain transition and emission probabilities by applying the EM algorithm. The steps are:<\/p>\n<p>&nbsp;<\/p>\n<p>1.Start with some initial model<\/p>\n<p>&nbsp;<\/p>\n<p>2. Compute the probability of (virtually) each state sequence given the current model<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">3. Use this probabilistic tagging to produce probabilistic counts for all parameters, and use these probabilistic counts to estimate a revised model, which increases the likelihood of the observed output W in each iteration<\/p>\n<p>&nbsp;<\/p>\n<p>4.\u00a0\u00a0\u00a0 Repeat until convergence<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><strong><em>No <\/em><\/strong><em>labeled training required. Initialize by lexicon constraints regarding possible POS for each word (cf. \u201cnoisy counting\u201d for PP\u2019s) . In other words we cannot calculate transition probabilities but do have values of emission probabilities. Therefore we start with some random values for the transition probabilities and continue until no improvement occurs.<\/em><\/p>\n<p>&nbsp;<\/p>\n<p>The EM algorithm is as follows:<\/p>\n<ul>\n<li>Choose initial model = &lt;<strong>a,b,g<\/strong>(1)&gt;<\/li>\n<li><span style=\"text-align: initial;font-size: 1em\">Repeat until results don\u2019t improve (much):<\/span><\/li>\n<li><span style=\"text-align: initial;font-size: 1em\">Compute pk based on current model, using Forward &amp; Backwards algorithms to compute A and B (Expectation for counts)<\/span><\/li>\n<li><span style=\"text-align: initial;font-size: 1em\">Compute new model &lt;<\/span><strong style=\"text-align: initial;font-size: 1em\">a\u2019<\/strong><span style=\"text-align: initial;font-size: 1em\">,<\/span><strong style=\"text-align: initial;font-size: 1em\">b\u2019<\/strong><span style=\"text-align: initial;font-size: 1em\">,<\/span><strong style=\"text-align: initial;font-size: 1em\">g<\/strong><span style=\"text-align: initial;font-size: 1em\">\u2019(1)&gt; (Maximization of parameters)<\/span><\/li>\n<\/ul>\n<p><span style=\"text-align: initial;font-size: 1em\">Note: Output likelihood is guaranteed to increase in each iteration, but might converge to a <\/span><em style=\"text-align: initial;font-size: 1em\">local<\/em><span style=\"text-align: initial;font-size: 1em\"> maximum<\/span><\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<p><strong>Summary<\/strong><\/p>\n<ul>\n<li>Explained the concept of Model Learning in HMM<\/li>\n<li>Discussed Expectation Maximization method for HMM parameter estimation<\/li>\n<li>Explained parameter estimation using unsupervised techniques<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><strong>Web Links<\/strong><\/p>\n<ul>\n<li>studentnet.cs.manchester.ac.uk\/ugt\/COMP24111\/&#8230;\/Nai ve-Bayes.ppt<\/li>\n<li>web.cecs.pdx.edu\/&#8230;\/2015BayesTrees&#8230;\/2014_0095_Example%20of%20<\/li>\n<li>https:\/\/cse.sc.edu\/~rose\/587\/PPT\/NaiveBayes.ppt<\/li>\n<li>www.cs.unc.edu\/~lazebnik\/spring09\/lec20_generative.ppt<\/li>\n<li>cis-linux1.temple.edu\/~latecki\/Courses\/RobotFall08\/&#8230;\/bayesNaive.ppt<\/li>\n<li>www.cs.bu.edu\/fac\/gkollios\/ada01\/LectNotes\/Bayesian.ppt<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>you can view video on HMM \u2013EM Algorithm<\/strong><\/td>\n<td><a href=\"https:\/\/youtu.be\/ib13-wwItjU\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-120\" src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"\" width=\"36\" height=\"36\" \/><\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Supporting &amp; Reference Materials<\/strong><\/p>\n<ul>\n<li>Tom <a href=\"http:\/\/www.amazon.in\/s\/ref=dp_byline_sr_book_1?ie=UTF8&amp;field-author=Mitchell&amp;search-alias=stripbooks\">Mitchell, <\/a>\u201cMachine Learning\u201d,McGraw-Hill Education, 1997<\/li>\n<li><a href=\"http:\/\/www.amazon.in\/s\/ref=dp_byline_sr_book_1?ie=UTF8&amp;field-author=Alpaydin+Ethem&amp;search-alias=stripbooks\">AlpaydinEthem, <\/a>\u201cIntroduction to Machine Learning\u201d, The MIT Press; third edition, 2014<\/li>\n<li>Christopher M. <a href=\"http:\/\/www.amazon.in\/s\/ref=dp_byline_sr_book_1?ie=UTF8&amp;field-author=Bishop&amp;search-alias=stripbooks\">Bishop, <\/a>\u201cPattern Recognition and Machine Learning\u201d,Springer, 2013 <a href=\"http:\/\/www.amazon.in\/s\/ref=dp_byline_sr_book_1?ie=UTF8&amp;field-author=Peter+Harrington&amp;search-alias=stripbooks\">Peter Harrington, <\/a>\u201cMachine Learning In Action\u201d, Manning Publications, 2012<\/li>\n<li><a href=\"http:\/\/www.amazon.in\/s\/ref=dp_byline_sr_book_1?ie=UTF8&amp;field-author=Peter+Flach&amp;search-alias=stripbooks\">Peter Flach, <\/a>\u201cMachine Learning: The Art and Science of Algorithms that Make Sense of Data\u201d,Cambridge University Press, 2012<\/li>\n<li><a href=\"http:\/\/www.amazon.in\/s\/ref=dp_byline_sr_book_1?ie=UTF8&amp;field-author=Stephen+Marsland&amp;search-alias=stripbooks\">Stephen Marsland, <\/a>\u201cMachine Learning: An Algorithmic Perspective\u201d, Chapman and Hall\/CRC; 2 edition, 2014<\/li>\n<li>Abu-Mostafa, M. Magdon-Ismail, and H.-T. Lin, \u201cLearning from Data\u201d, AMLBook, 2012.<\/li>\n<\/ul>\n","protected":false},"author":3,"menu_order":35,"template":"","meta":{"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":[],"pb_section_license":""},"chapter-type":[],"contributor":[],"license":[],"class_list":["post-821","chapter","type-chapter","status-publish","hentry"],"part":3,"_links":{"self":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/pressbooks\/v2\/chapters\/821","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/wp\/v2\/users\/3"}],"version-history":[{"count":8,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/pressbooks\/v2\/chapters\/821\/revisions"}],"predecessor-version":[{"id":845,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/pressbooks\/v2\/chapters\/821\/revisions\/845"}],"part":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/pressbooks\/v2\/parts\/3"}],"metadata":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/pressbooks\/v2\/chapters\/821\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/wp\/v2\/media?parent=821"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/pressbooks\/v2\/chapter-type?post=821"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/wp\/v2\/contributor?post=821"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/wp\/v2\/license?post=821"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}