{"id":712,"date":"2019-01-09T05:05:55","date_gmt":"2019-01-09T05:05:55","guid":{"rendered":"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/?post_type=chapter&#038;p=712"},"modified":"2019-01-09T06:08:37","modified_gmt":"2019-01-09T06:08:37","slug":"expectation-and-maximization","status":"publish","type":"chapter","link":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/chapter\/expectation-and-maximization\/","title":{"rendered":"Expectation and Maximization"},"content":{"raw":"<div><span style=\"float: right\"><a href=\"https:\/\/youtu.be\/8xgj4b_UY8Y\" 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<div>\r\n\r\n&nbsp;\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 Expectation Maximization (EM)\r\n\r\n&nbsp;\r\n\r\n\u2022\u00a0\u00a0\u00a0\u00a0\u00a0 To explain EM using a Coin Toss Example\r\n\r\n&nbsp;\r\n\r\n\u2022\u00a0\u00a0\u00a0\u00a0\u00a0 To understand the use of EM in K-means Algorithm\r\n\r\n&nbsp;\r\n\r\n<strong>33.1\u00a0 Introduction<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">The Expectation Maximization methodology was first presented in a general way by Dempster, Laird and Rubin in 1977. They define EM algorithm as an iterative estimation algorithm that can derive the maximum likelihood (ML) estimates in the presence of missing\/hidden data (\u201cincomplete data\u201d). As an example we have theclassical case of the Gaussian mixture, where we have a set of unknown Gaussian distributions.The goal of the EM algorithm is to facilitate maximum likelihood parameter estimation by introducing so-called hidden random variables which are not observed and therefore define the unobserved data.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">There are two main approaches to the applications of the EM algorithm. The first is when the data indeed has missing values, due to problems with or limitations of the observation process. The second approachis the optimization of the likelihood function is complex but however likelihood function can be simplified by assuming the existence of additional but missing (or hidden) parameters. The second type of application is more common in the pattern recognition. Now let us understand the concept of hidden and observed variables. Observed variables are directly measurable from the data, e.g. waveform values of a speech recording, Is it raining today? Did the smoke\u00a0<span style=\"font-size: 1em;text-align: initial\">alarm go off?. On the other hand hidden variablesinfluence the data, but are not trivial to measure e.g includethe phonemes that produce a given speech recording, the probability P (rain today | rain yesterday) and is the smoke alarm malfunctioning?<\/span><\/p>\r\n\r\n<\/div>\r\n<div>\r\n\r\n<img class=\"aligncenter size-full wp-image-716\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-152.png\" alt=\"\" width=\"363\" height=\"180\" \/>\r\n<p style=\"text-align: center\"><strong>Figure 33.1 Many to One Mapping<\/strong><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">In Figure 33.1 X can be considered as the underlying space, x is the complete data (required for ML), <em>Y<\/em> is the observation space, y is the actual observation and x is observed only by means of y(x) and <em>X<\/em>(y) is a subset of X determined by y. The term y=(x) indicates that y is observed as some mapping of x.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">The EM approach has found usage in filling in missing data in a sample, discovering the value of latent variables, estimating parameters of HMMs, estimating parameters of finite mixtures, unsupervised learning of clusters and finding parameters of Mixtures of Gaussians (MoG).<\/p>\r\n&nbsp;\r\n\r\n<strong>33.2 The EM algorithm<\/strong>\r\n\r\n&nbsp;\r\n\r\nThe steps of the EM algorithm are as follows:\r\n<ol>\r\n \t<li style=\"text-align: justify\">We first consider a set of starting parameters given a set of incomplete (observed) data and we assume that observed data come from a specific model<\/li>\r\n \t<li style=\"text-align: justify\">We then use the model to \u201cestimate\u201d the missing data . In other words after formulating some parameters from observed data to build a model, we use this model to guess the missing value\/data. This step is called the expectation step.<\/li>\r\n \t<li style=\"text-align: justify\">Now we use the \u201ccomplete\u201d data that we have estimated to update parameters whereusing the missing data and observed data, we find the most likely modified parameters to build the modified model. This is called the maximization step .<\/li>\r\n \t<li style=\"text-align: justify\">We repeat steps 2 &amp; 3 until convergence that is there is no change in the parameters of the model and the estimated model fits the observed data.<\/li>\r\n<\/ol>\r\n<\/div>\r\n&nbsp;\r\n<p style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">The general idea of the algorithm is that we start by devising a noisy channel that is we use any model that predicts the corpus observations via some hidden structure and we Initially guess the parameters of the model. It is best to make an educated guess but random assumptions can also work. Then we repeat until convergence the Expectation and Maximization steps. In the<\/span><strong style=\"text-align: initial;font-size: 1em\">Expectation<\/strong> <strong style=\"text-align: initial;font-size: 1em\">step <\/strong><span style=\"text-align: initial;font-size: 1em\">we use current parameters (and observations) to reconstruct hidden structure while in the <\/span><strong style=\"text-align: initial;font-size: 1em\">Maximization step<\/strong><span style=\"text-align: initial;font-size: 1em\"> weuse that hidden structure (and observations) to re-estimate parameters.<\/span><\/p>\r\n\r\n<div>\r\n\r\n<img class=\"aligncenter size-full wp-image-717\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-153.png\" alt=\"\" width=\"583\" height=\"287\" \/>\r\n<p style=\"text-align: center\"><strong>Figure 33.2 General Idea of the EM algorithm<\/strong><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">In the example shown in Figure 33.2, we initially guess the probabilities of unknown parameters using which we guess the hidden structure such as tags, parses, weather (E step) and use it along with the observed structure such as words, eating ice cream to again re-estimate the probabilities (M step).<\/p>\r\n&nbsp;\r\n\r\n<strong>33.3\u00a0 EM and Maximum Likelihood Estimates<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">As discussed above parameters describe the characteristics of a population. Their values are estimated from samples collected from that population.A maximum likelihood (ML) estimate is a parameter estimate that is most consistent with the sampled data since it attempts to maximize the likelihood function.<\/p>\r\n&nbsp;\r\n\r\nThe basic setting of EM which is essentially based on maximum likelihood estimates is outlined below:\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Let X be a set of data points considered as<strong>observed<\/strong> data and \u0398bethe parameter vector. Now EM is a method to find \u03b8<sub>ML<\/sub>where <em>L<\/em>(Q) is likelihood function<\/p>\r\n\r\n<\/div>\r\n<div>\r\n\r\n<img class=\"aligncenter size-full wp-image-718\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-154.png\" alt=\"\" width=\"277\" height=\"107\" \/>\r\n<p style=\"text-align: justify\">In essence we need to determine the probability of the observed data given the parameter vector. Now calculating P(X | \u03b8) directly is hard. However calculating P(X,Y|\u03b8) is much simpler, where Y is \u201chidden\u201d data (or \u201cmissing\u201d data) associated with the observed data.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">Let us first define Z = (X, Y) where Z is considered as the complete data that is \u201caugmented data\u201d, X is the observed data (\u201cincomplete\u201d data) and Y is the hidden data (\u201cmissing\u201d data). EM is an iterative method to perform Maximum Likelihood estimation which starts with an initial estimate for \u03b8andrefines the current estimate iteratively to increase the likelihood of the observed data:<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\"><em>p(Z\/<\/em>\u03b8<em>)<\/em><\/p>\r\n&nbsp;\r\n\r\n<strong>33.4 EM \u2013 Coin Toss Example<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">The EM strategy can be explained with a coin toss example. This is the example we will be using in subsequent iterations to explain the complete flow of the EM algorithm. In this example we assume that we are tossing a number of coins sequentially to obtain a sequence of Head or Tails. The context of the coin toss example is given in Table 33.1. Here the problem is defined as X, the sequence of Heads and Tails that is observed, Y as the identifier of the coin that is tossed in the sequence, which is hidden and finally \u03b8which is the parameter vector which is associated with the probabilities ofthe observed and hidden data. Here if we assume three coins are tossed \u03bb is the probability of coin 0 showing H (so 1 \u2212 \u03bb is the probability of it showing T), p1 is the probability of coin 1 showing H, and p2 is the probability of coin 2 showing H.<\/p>\r\n&nbsp;\r\n<table class=\"aligncenter\" style=\"width: 60%\" border=\"1\">\r\n<tbody>\r\n<tr>\r\n<td>Problem<\/td>\r\n<td>Coin toss<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>X(observed)<\/td>\r\n<td>Head-tail sequences<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Y (hidden)<\/td>\r\n<td>Coin id sequences<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>\u0398<\/td>\r\n<td>p1, p2, \u03bb<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<p style=\"text-align: center\"><strong>Table 33.1 Parameters of EM<\/strong><\/p>\r\n\r\n<\/div>\r\n<strong>\u00a0<\/strong>\r\n<p style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">We can also modify the problem to figure out the probability of heads for two coins. Normally the ML estimate can be directly calculated from the results if we know the identity of which of the coins was tossed.<\/span><\/p>\r\n\r\n<div>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">We have two coins indicated as coins<strong>A<\/strong> and <strong>B<\/strong>and let us assume that the probabilities for heads are <strong>q<\/strong><strong><em>A<\/em><\/strong>&amp;<strong>q<\/strong> <strong><em>B<\/em><\/strong>respectively. We are given 5 measurements sets including 10 coin tosses in each set. Now we know which coin has been tossed in each measurement. The example sets of experiments are given in Table 33.2. In this table A coin has been indicated as red and B coin as blue. The first column in the table indicates the coin type for each of the 5 measurements since here we assume we know the identity of the coin. The second column indicates the sequence of 10 Heads and Tails observed for each measurement. Columns 3 and 4 indicate the number of Heads and Tails obtained in each coin toss for each measurement of each coin type. The final row shows the total number of Heads and Tails obtained for the measurements for each of the A and B coin types.<\/p>\r\n&nbsp;\r\n\r\n<img class=\"aligncenter size-full wp-image-719\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-155.png\" alt=\"\" width=\"521\" height=\"322\" \/>\r\n<p style=\"text-align: center\"><strong>Table 33.2 Coin Toss Example of 5 measurements of 10 coin Tosses<\/strong><\/p>\r\n&nbsp;\r\n\r\nNow we calculate the ML probabilities<strong>q<\/strong><strong><em>A<\/em><\/strong>&amp;<strong>q<\/strong> <strong><em>B<\/em><\/strong>, the probabilities for heads of coins A and B respectively.\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\"><strong>Maximum Likelihood<\/strong>of theprobabilities<strong> q<\/strong><strong><em>A<\/em><\/strong>&amp;<strong>q <\/strong><strong><em>B<\/em><\/strong>arecalculated by dividing the total number of Heads obtained by the total number of Head and Tails observed for each type of coin. Thus we get<\/p>\r\n&nbsp;\r\n\r\n<strong>q<\/strong><sub><strong><em>A<\/em><\/strong><\/sub> = 24\/24+6 = 24\/30 = 0.8\r\n\r\n&nbsp;\r\n\r\n<strong>q<\/strong><sub><strong><em>B<\/em><\/strong><\/sub> = 9\/9+11=9\/20=0.45\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">The above calculation is a basic probability calculation based on observations knowing whether coin A or B has been tossed.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">We will now make the problem more interesting and assume that we do not even know which one of the coins is used for the sample set . Now we need to estimate the coin probabilities without knowing which one of the coins is being tossed.<\/p>\r\n&nbsp;\r\n\r\n<strong>33.5 EM Flow Explained with Coin Toss Example<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Note that when we do not know which of the coins is tossed in each set we cannot calculate ML directly and hence we use EM strategy to find the probabilities of which one of the coins is likely to be tossed. Figure 33.3 shows the complete flow of the EM algorithm. Remember we do not know which of the coins is tossed. Hence we start the process by assuming that for each of the coins A (red) and B (blue), the initial probabilities for heads are <strong>q<\/strong><strong><em>A<\/em><\/strong>&amp;<strong>q\u00a0<\/strong><strong><em>B<\/em><\/strong>respectivelywhich are assumed to have random values. Hence as seen from Figure 33.3 we have randomly fixed <strong>q<\/strong><strong><em>A<\/em><\/strong>to be 0.6 and <strong>q<\/strong> <strong><em>B<\/em><\/strong>to be 0.5. Now we observe the number of Heads and Tails for each of the 5 measurements.<\/p>\r\n&nbsp;\r\n\r\n<strong>E Step:<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">The first stage is the <strong>Expectation<\/strong>stage for which we initially use the randomly assumed probabilities of <strong>q<\/strong><strong><em>A<\/em><\/strong>&amp;<strong>q<\/strong> <strong><em>B<\/em><\/strong> and the set of coin tosses observed for each measurement. Now we need to calculate the probabilities for Heads and Tails for both A and B coins for each measurement since we do not know which coin is tossed. We have shown the calculation for the first set .of measurements in Figure 33.3.<\/p>\r\n&nbsp;\r\n\r\n<strong>Step E-C1<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">In the first step of the <strong>Expectation stage<\/strong> we assume that the coin toss sequence follows a binomial distribution, where n is total number of coin tosses, k is number of Heads (Tails) observed and p is the probability of observing heads for each coin.<\/p>\r\n\r\n<\/div>\r\n<div>\r\n\r\n<img class=\"aligncenter size-full wp-image-720\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-156.png\" alt=\"\" width=\"167\" height=\"70\" \/>\r\n\r\n<img class=\"aligncenter size-full wp-image-721\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-157.png\" alt=\"\" width=\"608\" height=\"283\" \/>\r\n\r\n&nbsp;\r\n<p style=\"text-align: center\"><strong>Figure 33.3 Flow of EM - Coin Toss Example<\/strong><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">Usingthe distribution we can calculate the probability of observing Heads and Tails for coins A and B for the first set as shown in Figure 33.4. Here<\/p>\r\n&nbsp;\r\n\r\nn - the total number of coins tossed in the first measurement = <strong>10,<\/strong> k -the total number of heads observed =<strong>5<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Now we need to calculate the probability of observing Heads(Tails) for both coins A and B since we do not know which of the coins was tossed and hence p \u2013 (q<em>A<\/em>)- the probability of heads for A (red) coin is initially assumed to be = <strong>0.6<\/strong> &amp; (q<em>b<\/em>)- the probability of heads for B (blue) coin is initially assumed to be = <strong>0.5<\/strong><\/p>\r\n&nbsp;\r\n\r\n<img class=\"aligncenter size-full wp-image-722\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-158.png\" alt=\"\" width=\"340\" height=\"203\" \/>\r\n<p style=\"text-align: center\"><strong>Figure 33.4 Use of Binomial Distribution<\/strong><\/p>\r\n&nbsp;\r\n\r\n<strong>Step E-C2<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">In the second step of the Expectation stage we calculate the probabilities of using coin A or B as follows:<\/p>\r\n<strong>0.201\/ (0.201+0.246)=0.45<\/strong>\r\n\r\n&nbsp;\r\n\r\n<strong>0.246\/ (0.201+0.246)=0.55<\/strong>\r\n\r\n&nbsp;\r\n\r\nWe calculate in a similar manner for all the experiments and the values obtained are shown in Figure 33.3.\r\n\r\n&nbsp;\r\n\r\n<strong>Step E-C3<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">In the third step of the Expectation stage using the probability values obtained in step E-C2, we calculate the possible number of Heads and Tails that is likely\u00a0<span style=\"font-size: 1em;text-align: initial\">to be observed in each experiment if the coin tossed was A and if the coin tossed was B<\/span><\/p>\r\n\r\n<\/div>\r\n<div>\r\n\r\n<strong>First Experiment \u2013 values corresponding to first row:<\/strong>\r\n\r\n&nbsp;\r\n\r\n(i)\u00a0 5(number of heads in First experiment)\r\n\r\n&nbsp;\r\n\r\n*0.45(probability of tossing coin A)=2.2H,\r\n\r\n&nbsp;\r\n\r\n(ii)\u00a0 5(number of Tails in First experiment)\r\n\r\n&nbsp;\r\n\r\n*0.45(probability of tossing coin A)=2.2H,\r\n\r\n&nbsp;\r\n\r\n(iii)\u00a0\u00a0 5(number of heads in First experiment) *0.55(probability of tossing coin B)=2.8H, (\r\n\r\n&nbsp;\r\n\r\niv)5(number of Tails in First experiment) *0.55(probability of tossing coin B)=2.8H.\r\n\r\n&nbsp;\r\n\r\nWe will also explain the calculations for second experiment .\r\n\r\n&nbsp;\r\n\r\n<strong>Second Experiment \u2013 values corresponding to second row:<\/strong>\r\n\r\n&nbsp;\r\n\r\n(i)\u00a0 9(number of heads in Second experiment)\r\n\r\n&nbsp;\r\n\r\n*0.80(probability of tossing coin A)=7.2H,\r\n\r\n&nbsp;\r\n\r\n(ii)\u00a0 1(number of Tails in Second experiment)\r\n\r\n&nbsp;\r\n\r\n*0.8(probability of tossing coin A)=0.8H,\r\n\r\n&nbsp;\r\n\r\n(iii)\u00a0 9(number of heads in Second experiment) *0.20(probability of tossing coin B)=1.8H, (iv)1(number of Tails in Second experiment)\r\n\r\n&nbsp;\r\n\r\n*0.20(probability of tossing coin B)=0.2H.\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Similarly we can do the calculations for all 5 experiments. Using these calculated values for number of Head and Tails for each experiment, we can calculate the total number of Heads and Tails for both Coins A and B.<\/p>\r\n&nbsp;\r\n\r\n<strong>M Step<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Now we have the Maximization stage where we calculate the new values (after 1st\u00a0 iteration) of <strong>q<\/strong><em style=\"font-weight: bold\">A<\/em>\u00a0<strong><em>B<\/em><\/strong><strong><em>(1)<\/em><\/strong>that is the maximum likelihood estimates of the probability of heads when coin A and probability of heads when coin B are tossed respectively using the values total number of Heads and Tails for both Coins A and B. This calculation is shown below:<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\"><strong>q<\/strong><strong><em>A<\/em><\/strong><strong><em>(1)<\/em><\/strong>= 21.3(total number of Heads when coin A is tossed)\/(21.3+8.6)(total number of Heads and Tails when coin A is tossed)= <strong>0.71<\/strong><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\"><strong>q <\/strong><strong><em>B<\/em><\/strong><strong><em>(1)<\/em><\/strong>= 11.7(total number of Heads when coin B is tossed)\/(11.7+8.4)(total number of Heads and Tails when coin B is tossed)=<strong>0.58<\/strong><\/p>\r\n&nbsp;\r\n\r\n<strong>Continuing and Completing the EM algorithm<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Now we have completed one iteration of the EM algorithm. We now continue the second iteration of the algorithm using the above new values of <strong>q<\/strong><strong><em>A<\/em><\/strong>&amp;<strong>q<\/strong> <strong><em>B<\/em><\/strong>. We continue the iterations until the values of <strong>q<\/strong><strong><em>A<\/em><\/strong>&amp;<strong>q<\/strong> <strong><em>B<\/em><\/strong> do not change from one iteration to the next. This happens in the 10th iteration for our example (shown in Figure 33.3) when the values <strong>q<\/strong><strong><em>A<\/em><\/strong>&amp;<strong>q<\/strong> <strong><em>B<\/em><\/strong> converge to values <strong>0.80<\/strong> and <strong>0.52<\/strong> respectively.<\/p>\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n\r\n<strong>33.6 Kmeans and EM algorithm<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">We can explain K means as an EM algorithm. First we initialize the k means (mk) of the Kmeans algorithm. In the E Step weassign each point to a Cluster and during the M Step given the Clusters we refine mean mkof each cluster k. This process is repeated until the change in means is small.<\/p>\r\n&nbsp;\r\n\r\n<strong>33.6.1 Generating Data from Mixture of Gaussians<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Now we can replace the \u2018hard\u2019 clustering of K-means described above with \u2018soft\u2019 probabilistic assignments . Here we assume that each instance x is generated<\/p>\r\n<img class=\"aligncenter size-full wp-image-723\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-159.png\" alt=\"\" width=\"397\" height=\"180\" \/>\r\n<p style=\"text-align: center\"><strong>Figure 33.5 The Gaussian Distributions used to Generate Data<\/strong><\/p>\r\n<img class=\"aligncenter size-full wp-image-724\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-160.png\" alt=\"\" width=\"579\" height=\"240\" \/>\r\n<p style=\"text-align: center\"><strong>Figure 33.6 The Use of a Mixture of Gaussians for Generating Data<\/strong><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">by choosing one of the k Gaussians at random and generating an instance according to that Gaussian(Figure 33.5). This requires more parameters to be determined that would fit the data. Figure 33.6 shows the probability of generating data p(X). This probability is based on the Gaussian distributions used, the mean and the variance of the Gaussian distributions and the mixing coefficients used. The sum of the mixing coefficients of all the Gaussian distributions use must be 1.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\"><strong style=\"text-align: initial;font-size: 1em\">33.6.2 K-means and Mixture of Gaussians<\/strong><\/p>\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Now we know that in a general K-means which is essentially a classifier and we need to find the parameterto fit data \u2013 that is we need to find the mean - \u00b5<em>k<\/em> as already discussed above. However when we use mixture of Gaussians which is a probability model where we are defining a \u201csoft\u201d classifier. Now the parameters that are to be determined to fit to data are the means \u00b5<em>k<\/em><em>and c<\/em>ovariance \u03a3<em>k<\/em>which define the Gaussians distributions and the mixing coefficient \u03c0<em>k<\/em><em>.<\/em> Now given the data set, find the mixing coefficients, means and covariance. If we knew which component generated each data point, the maximum likelihood solution would involve fitting each component to the corresponding cluster . However our problem is that the data set is unlabelled or are hidden (Figure 33.7).<\/p>\r\n<img class=\"aligncenter size-full wp-image-725\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-161.png\" alt=\"\" width=\"584\" height=\"209\" \/>\r\n<p style=\"text-align: center\"><strong>Figure 33.7 K Means Scenario<\/strong><\/p>\r\n<img class=\"aligncenter size-full wp-image-726\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-162.png\" alt=\"\" width=\"584\" height=\"276\" \/>\r\n\r\n<strong>Figure 33.8 K means with Initial Guess of Cluster Points 33.6.3 EM for Estimating k Means<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Figure 33.8 shows the scenario of K means the instances from X are generated by a mixture of k Gaussians with unknown means &lt;m1,\u2026,mk&gt; of the k Gaussians.Remember we do not know which instance xi was generated by\u00a0<span style=\"font-size: 1em;text-align: initial\">which Gaussian. Now we need to determine the maximum likelihood estimates of &lt;m1,\u2026,mk&gt;. Now let us define the full description of each instance as yi=&lt;xi,zi1,zi2&gt; where zij is 1 if xi generated by j-th Gaussian. In this case xiis observable but however zijis unobservable.<\/span><\/p>\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n\r\n<strong>33.6.4 EM for Gaussian Mixtures<\/strong>\r\n\r\n&nbsp;\r\n\r\nHere we initialize the Gaussian parameters mean mk, co-variance \u00e5 k and mixing coefficient pk.\r\n\r\n&nbsp;\r\n\r\n<strong>E Step:<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">In the E Step we assign each point xn an assignment score g(znk) for each cluster or Gaussian kwhich essentially indicates how much this Gaussian k is responsible for point Xn<\/p>\r\n&nbsp;\r\n\r\n<img class=\"aligncenter size-full wp-image-727\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-163.png\" alt=\"\" width=\"405\" height=\"146\" \/>\r\n<p style=\"text-align: center\"><strong>Figure 33.9 Calculation of Assignment Score<\/strong><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">Here g(znk) is calculated as the mean and covariance of the Gaussian distribution corresponding to the kth mean multiplied by mixture coefficient of kth distribution divided by the summation of mean and covariance of all the Gaussian distributions multiplied by their corresponding mixture coefficient.<\/p>\r\n&nbsp;\r\n\r\n<strong>M step<\/strong>\r\n<p style=\"text-align: justify\">During the M Step, given scores, adjust mk, \u00e5 k, pk for each cluster kor Gaussian K. We update parameters using new g(znk) that is find the parameters that fit the new assignment score g(znk) the best. The new values of each of the parameters mknew , \u00e5 knew and pknew are determined as shown in Figure 33.10.<\/p>\r\n\r\n<\/div>\r\n<img class=\"aligncenter size-full wp-image-728\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-164.png\" alt=\"\" width=\"588\" height=\"197\" \/>\r\n<p style=\"text-align: center\"><strong>Figure 33.10 Calculating new Values of Parameters during M Step<\/strong><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">Now we evaluate log likelihood as shown in Figure 33.11 . If likelihood or parameters converge we stop else we iterate with the E and M steps.<\/p>\r\n<img class=\"aligncenter size-full wp-image-729\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-165.png\" alt=\"\" width=\"497\" height=\"98\" \/>\r\n<p style=\"text-align: center\"><strong>Figure 33.11 Evaluation of Log Likelihood<\/strong><\/p>\r\n&nbsp;\r\n\r\n<strong>33.7 Strengths of EM<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">The major strength of the EM algorithm is its numerical stability where in every iteration of the EM algorithm, the likelihood of the observed data increases that is we are heading towards a solution. In addition, the EM handles parameter constraints gracefully.<\/p>\r\n&nbsp;\r\n\r\n<strong>33.8 Problems with EM<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">In the case of EM algorithms can converge very slowly on some problems and this convergence is intimately related to the amount of missing information.It guarantees to improve the probability of the training corpus, which is different from reducing the errors directly. The EM algorithm cannot guarantee to reach global maximum and sometimes could get struck at the local maxima, saddle points, etc. Essentially the guess we make of the initial parameter values is very important and can decide on the time to converge.<\/p>\r\n&nbsp;\r\n\r\n<strong>Summary<\/strong>\r\n<ul>\r\n \t<li>Explained the concept of Expectation Maximization (EM)<\/li>\r\n \t<li>Discussed EM using a Coin Toss Example<\/li>\r\n \t<li>Outlined the use of EM in K-means Algorithm<\/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 Expectation and Maximization<\/strong><\/td>\r\n<td><a href=\"https:\/\/youtu.be\/8xgj4b_UY8Y\" 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<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<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>S. Abu-Mostafa, M. Magdon-Ismail, and H.-T. Lin, \u201cLearning from Data\u201d, AMLBook, 2012.<\/li>\r\n<\/ul>\r\n&nbsp;","rendered":"<div><span style=\"float: right\"><a href=\"https:\/\/youtu.be\/8xgj4b_UY8Y\" 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>&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 Expectation Maximization (EM)<\/p>\n<p>&nbsp;<\/p>\n<p>\u2022\u00a0\u00a0\u00a0\u00a0\u00a0 To explain EM using a Coin Toss Example<\/p>\n<p>&nbsp;<\/p>\n<p>\u2022\u00a0\u00a0\u00a0\u00a0\u00a0 To understand the use of EM in K-means Algorithm<\/p>\n<p>&nbsp;<\/p>\n<p><strong>33.1\u00a0 Introduction<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The Expectation Maximization methodology was first presented in a general way by Dempster, Laird and Rubin in 1977. They define EM algorithm as an iterative estimation algorithm that can derive the maximum likelihood (ML) estimates in the presence of missing\/hidden data (\u201cincomplete data\u201d). As an example we have theclassical case of the Gaussian mixture, where we have a set of unknown Gaussian distributions.The goal of the EM algorithm is to facilitate maximum likelihood parameter estimation by introducing so-called hidden random variables which are not observed and therefore define the unobserved data.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">There are two main approaches to the applications of the EM algorithm. The first is when the data indeed has missing values, due to problems with or limitations of the observation process. The second approachis the optimization of the likelihood function is complex but however likelihood function can be simplified by assuming the existence of additional but missing (or hidden) parameters. The second type of application is more common in the pattern recognition. Now let us understand the concept of hidden and observed variables. Observed variables are directly measurable from the data, e.g. waveform values of a speech recording, Is it raining today? Did the smoke\u00a0<span style=\"font-size: 1em;text-align: initial\">alarm go off?. On the other hand hidden variablesinfluence the data, but are not trivial to measure e.g includethe phonemes that produce a given speech recording, the probability P (rain today | rain yesterday) and is the smoke alarm malfunctioning?<\/span><\/p>\n<\/div>\n<div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-716\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-152.png\" alt=\"\" width=\"363\" height=\"180\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-152.png 363w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-152-300x149.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-152-65x32.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-152-225x112.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-152-350x174.png 350w\" sizes=\"auto, (max-width: 363px) 100vw, 363px\" \/><\/p>\n<p style=\"text-align: center\"><strong>Figure 33.1 Many to One Mapping<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">In Figure 33.1 X can be considered as the underlying space, x is the complete data (required for ML), <em>Y<\/em> is the observation space, y is the actual observation and x is observed only by means of y(x) and <em>X<\/em>(y) is a subset of X determined by y. The term y=(x) indicates that y is observed as some mapping of x.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The EM approach has found usage in filling in missing data in a sample, discovering the value of latent variables, estimating parameters of HMMs, estimating parameters of finite mixtures, unsupervised learning of clusters and finding parameters of Mixtures of Gaussians (MoG).<\/p>\n<p>&nbsp;<\/p>\n<p><strong>33.2 The EM algorithm<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>The steps of the EM algorithm are as follows:<\/p>\n<ol>\n<li style=\"text-align: justify\">We first consider a set of starting parameters given a set of incomplete (observed) data and we assume that observed data come from a specific model<\/li>\n<li style=\"text-align: justify\">We then use the model to \u201cestimate\u201d the missing data . In other words after formulating some parameters from observed data to build a model, we use this model to guess the missing value\/data. This step is called the expectation step.<\/li>\n<li style=\"text-align: justify\">Now we use the \u201ccomplete\u201d data that we have estimated to update parameters whereusing the missing data and observed data, we find the most likely modified parameters to build the modified model. This is called the maximization step .<\/li>\n<li style=\"text-align: justify\">We repeat steps 2 &amp; 3 until convergence that is there is no change in the parameters of the model and the estimated model fits the observed data.<\/li>\n<\/ol>\n<\/div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">The general idea of the algorithm is that we start by devising a noisy channel that is we use any model that predicts the corpus observations via some hidden structure and we Initially guess the parameters of the model. It is best to make an educated guess but random assumptions can also work. Then we repeat until convergence the Expectation and Maximization steps. In the<\/span><strong style=\"text-align: initial;font-size: 1em\">Expectation<\/strong> <strong style=\"text-align: initial;font-size: 1em\">step <\/strong><span style=\"text-align: initial;font-size: 1em\">we use current parameters (and observations) to reconstruct hidden structure while in the <\/span><strong style=\"text-align: initial;font-size: 1em\">Maximization step<\/strong><span style=\"text-align: initial;font-size: 1em\"> weuse that hidden structure (and observations) to re-estimate parameters.<\/span><\/p>\n<div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-717\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-153.png\" alt=\"\" width=\"583\" height=\"287\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-153.png 583w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-153-300x148.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-153-65x32.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-153-225x111.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-153-350x172.png 350w\" sizes=\"auto, (max-width: 583px) 100vw, 583px\" \/><\/p>\n<p style=\"text-align: center\"><strong>Figure 33.2 General Idea of the EM algorithm<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">In the example shown in Figure 33.2, we initially guess the probabilities of unknown parameters using which we guess the hidden structure such as tags, parses, weather (E step) and use it along with the observed structure such as words, eating ice cream to again re-estimate the probabilities (M step).<\/p>\n<p>&nbsp;<\/p>\n<p><strong>33.3\u00a0 EM and Maximum Likelihood Estimates<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">As discussed above parameters describe the characteristics of a population. Their values are estimated from samples collected from that population.A maximum likelihood (ML) estimate is a parameter estimate that is most consistent with the sampled data since it attempts to maximize the likelihood function.<\/p>\n<p>&nbsp;<\/p>\n<p>The basic setting of EM which is essentially based on maximum likelihood estimates is outlined below:<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Let X be a set of data points considered as<strong>observed<\/strong> data and \u0398bethe parameter vector. Now EM is a method to find \u03b8<sub>ML<\/sub>where <em>L<\/em>(Q) is likelihood function<\/p>\n<\/div>\n<div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-718\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-154.png\" alt=\"\" width=\"277\" height=\"107\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-154.png 277w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-154-65x25.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-154-225x87.png 225w\" sizes=\"auto, (max-width: 277px) 100vw, 277px\" \/><\/p>\n<p style=\"text-align: justify\">In essence we need to determine the probability of the observed data given the parameter vector. Now calculating P(X | \u03b8) directly is hard. However calculating P(X,Y|\u03b8) is much simpler, where Y is \u201chidden\u201d data (or \u201cmissing\u201d data) associated with the observed data.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Let us first define Z = (X, Y) where Z is considered as the complete data that is \u201caugmented data\u201d, X is the observed data (\u201cincomplete\u201d data) and Y is the hidden data (\u201cmissing\u201d data). EM is an iterative method to perform Maximum Likelihood estimation which starts with an initial estimate for \u03b8andrefines the current estimate iteratively to increase the likelihood of the observed data:<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><em>p(Z\/<\/em>\u03b8<em>)<\/em><\/p>\n<p>&nbsp;<\/p>\n<p><strong>33.4 EM \u2013 Coin Toss Example<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The EM strategy can be explained with a coin toss example. This is the example we will be using in subsequent iterations to explain the complete flow of the EM algorithm. In this example we assume that we are tossing a number of coins sequentially to obtain a sequence of Head or Tails. The context of the coin toss example is given in Table 33.1. Here the problem is defined as X, the sequence of Heads and Tails that is observed, Y as the identifier of the coin that is tossed in the sequence, which is hidden and finally \u03b8which is the parameter vector which is associated with the probabilities ofthe observed and hidden data. Here if we assume three coins are tossed \u03bb is the probability of coin 0 showing H (so 1 \u2212 \u03bb is the probability of it showing T), p1 is the probability of coin 1 showing H, and p2 is the probability of coin 2 showing H.<\/p>\n<p>&nbsp;<\/p>\n<table class=\"aligncenter\" style=\"width: 60%\">\n<tbody>\n<tr>\n<td>Problem<\/td>\n<td>Coin toss<\/td>\n<\/tr>\n<tr>\n<td>X(observed)<\/td>\n<td>Head-tail sequences<\/td>\n<\/tr>\n<tr>\n<td>Y (hidden)<\/td>\n<td>Coin id sequences<\/td>\n<\/tr>\n<tr>\n<td>\u0398<\/td>\n<td>p1, p2, \u03bb<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"text-align: center\"><strong>Table 33.1 Parameters of EM<\/strong><\/p>\n<\/div>\n<p><strong>\u00a0<\/strong><\/p>\n<p style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">We can also modify the problem to figure out the probability of heads for two coins. Normally the ML estimate can be directly calculated from the results if we know the identity of which of the coins was tossed.<\/span><\/p>\n<div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">We have two coins indicated as coins<strong>A<\/strong> and <strong>B<\/strong>and let us assume that the probabilities for heads are <strong>q<\/strong><strong><em>A<\/em><\/strong>&amp;<strong>q<\/strong> <strong><em>B<\/em><\/strong>respectively. We are given 5 measurements sets including 10 coin tosses in each set. Now we know which coin has been tossed in each measurement. The example sets of experiments are given in Table 33.2. In this table A coin has been indicated as red and B coin as blue. The first column in the table indicates the coin type for each of the 5 measurements since here we assume we know the identity of the coin. The second column indicates the sequence of 10 Heads and Tails observed for each measurement. Columns 3 and 4 indicate the number of Heads and Tails obtained in each coin toss for each measurement of each coin type. The final row shows the total number of Heads and Tails obtained for the measurements for each of the A and B coin types.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-719\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-155.png\" alt=\"\" width=\"521\" height=\"322\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-155.png 521w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-155-300x185.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-155-65x40.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-155-225x139.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-155-350x216.png 350w\" sizes=\"auto, (max-width: 521px) 100vw, 521px\" \/><\/p>\n<p style=\"text-align: center\"><strong>Table 33.2 Coin Toss Example of 5 measurements of 10 coin Tosses<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Now we calculate the ML probabilities<strong>q<\/strong><strong><em>A<\/em><\/strong>&amp;<strong>q<\/strong> <strong><em>B<\/em><\/strong>, the probabilities for heads of coins A and B respectively.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><strong>Maximum Likelihood<\/strong>of theprobabilities<strong> q<\/strong><strong><em>A<\/em><\/strong>&amp;<strong>q <\/strong><strong><em>B<\/em><\/strong>arecalculated by dividing the total number of Heads obtained by the total number of Head and Tails observed for each type of coin. Thus we get<\/p>\n<p>&nbsp;<\/p>\n<p><strong>q<\/strong><sub><strong><em>A<\/em><\/strong><\/sub> = 24\/24+6 = 24\/30 = 0.8<\/p>\n<p>&nbsp;<\/p>\n<p><strong>q<\/strong><sub><strong><em>B<\/em><\/strong><\/sub> = 9\/9+11=9\/20=0.45<\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The above calculation is a basic probability calculation based on observations knowing whether coin A or B has been tossed.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">We will now make the problem more interesting and assume that we do not even know which one of the coins is used for the sample set . Now we need to estimate the coin probabilities without knowing which one of the coins is being tossed.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>33.5 EM Flow Explained with Coin Toss Example<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Note that when we do not know which of the coins is tossed in each set we cannot calculate ML directly and hence we use EM strategy to find the probabilities of which one of the coins is likely to be tossed. Figure 33.3 shows the complete flow of the EM algorithm. Remember we do not know which of the coins is tossed. Hence we start the process by assuming that for each of the coins A (red) and B (blue), the initial probabilities for heads are <strong>q<\/strong><strong><em>A<\/em><\/strong>&amp;<strong>q\u00a0<\/strong><strong><em>B<\/em><\/strong>respectivelywhich are assumed to have random values. Hence as seen from Figure 33.3 we have randomly fixed <strong>q<\/strong><strong><em>A<\/em><\/strong>to be 0.6 and <strong>q<\/strong> <strong><em>B<\/em><\/strong>to be 0.5. Now we observe the number of Heads and Tails for each of the 5 measurements.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>E Step:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The first stage is the <strong>Expectation<\/strong>stage for which we initially use the randomly assumed probabilities of <strong>q<\/strong><strong><em>A<\/em><\/strong>&amp;<strong>q<\/strong> <strong><em>B<\/em><\/strong> and the set of coin tosses observed for each measurement. Now we need to calculate the probabilities for Heads and Tails for both A and B coins for each measurement since we do not know which coin is tossed. We have shown the calculation for the first set .of measurements in Figure 33.3.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Step E-C1<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">In the first step of the <strong>Expectation stage<\/strong> we assume that the coin toss sequence follows a binomial distribution, where n is total number of coin tosses, k is number of Heads (Tails) observed and p is the probability of observing heads for each coin.<\/p>\n<\/div>\n<div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-720\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-156.png\" alt=\"\" width=\"167\" height=\"70\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-156.png 167w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-156-65x27.png 65w\" sizes=\"auto, (max-width: 167px) 100vw, 167px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-721\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-157.png\" alt=\"\" width=\"608\" height=\"283\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-157.png 608w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-157-300x140.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-157-65x30.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-157-225x105.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-157-350x163.png 350w\" sizes=\"auto, (max-width: 608px) 100vw, 608px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><strong>Figure 33.3 Flow of EM &#8211; Coin Toss Example<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Usingthe distribution we can calculate the probability of observing Heads and Tails for coins A and B for the first set as shown in Figure 33.4. Here<\/p>\n<p>&nbsp;<\/p>\n<p>n &#8211; the total number of coins tossed in the first measurement = <strong>10,<\/strong> k -the total number of heads observed =<strong>5<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Now we need to calculate the probability of observing Heads(Tails) for both coins A and B since we do not know which of the coins was tossed and hence p \u2013 (q<em>A<\/em>)- the probability of heads for A (red) coin is initially assumed to be = <strong>0.6<\/strong> &amp; (q<em>b<\/em>)- the probability of heads for B (blue) coin is initially assumed to be = <strong>0.5<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-722\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-158.png\" alt=\"\" width=\"340\" height=\"203\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-158.png 340w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-158-300x179.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-158-65x39.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-158-225x134.png 225w\" sizes=\"auto, (max-width: 340px) 100vw, 340px\" \/><\/p>\n<p style=\"text-align: center\"><strong>Figure 33.4 Use of Binomial Distribution<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Step E-C2<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">In the second step of the Expectation stage we calculate the probabilities of using coin A or B as follows:<\/p>\n<p><strong>0.201\/ (0.201+0.246)=0.45<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><strong>0.246\/ (0.201+0.246)=0.55<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>We calculate in a similar manner for all the experiments and the values obtained are shown in Figure 33.3.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Step E-C3<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">In the third step of the Expectation stage using the probability values obtained in step E-C2, we calculate the possible number of Heads and Tails that is likely\u00a0<span style=\"font-size: 1em;text-align: initial\">to be observed in each experiment if the coin tossed was A and if the coin tossed was B<\/span><\/p>\n<\/div>\n<div>\n<p><strong>First Experiment \u2013 values corresponding to first row:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>(i)\u00a0 5(number of heads in First experiment)<\/p>\n<p>&nbsp;<\/p>\n<p>*0.45(probability of tossing coin A)=2.2H,<\/p>\n<p>&nbsp;<\/p>\n<p>(ii)\u00a0 5(number of Tails in First experiment)<\/p>\n<p>&nbsp;<\/p>\n<p>*0.45(probability of tossing coin A)=2.2H,<\/p>\n<p>&nbsp;<\/p>\n<p>(iii)\u00a0\u00a0 5(number of heads in First experiment) *0.55(probability of tossing coin B)=2.8H, (<\/p>\n<p>&nbsp;<\/p>\n<p>iv)5(number of Tails in First experiment) *0.55(probability of tossing coin B)=2.8H.<\/p>\n<p>&nbsp;<\/p>\n<p>We will also explain the calculations for second experiment .<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Second Experiment \u2013 values corresponding to second row:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>(i)\u00a0 9(number of heads in Second experiment)<\/p>\n<p>&nbsp;<\/p>\n<p>*0.80(probability of tossing coin A)=7.2H,<\/p>\n<p>&nbsp;<\/p>\n<p>(ii)\u00a0 1(number of Tails in Second experiment)<\/p>\n<p>&nbsp;<\/p>\n<p>*0.8(probability of tossing coin A)=0.8H,<\/p>\n<p>&nbsp;<\/p>\n<p>(iii)\u00a0 9(number of heads in Second experiment) *0.20(probability of tossing coin B)=1.8H, (iv)1(number of Tails in Second experiment)<\/p>\n<p>&nbsp;<\/p>\n<p>*0.20(probability of tossing coin B)=0.2H.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Similarly we can do the calculations for all 5 experiments. Using these calculated values for number of Head and Tails for each experiment, we can calculate the total number of Heads and Tails for both Coins A and B.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>M Step<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Now we have the Maximization stage where we calculate the new values (after 1st\u00a0 iteration) of <strong>q<\/strong><em style=\"font-weight: bold\">A<\/em>\u00a0<strong><em>B<\/em><\/strong><strong><em>(1)<\/em><\/strong>that is the maximum likelihood estimates of the probability of heads when coin A and probability of heads when coin B are tossed respectively using the values total number of Heads and Tails for both Coins A and B. This calculation is shown below:<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><strong>q<\/strong><strong><em>A<\/em><\/strong><strong><em>(1)<\/em><\/strong>= 21.3(total number of Heads when coin A is tossed)\/(21.3+8.6)(total number of Heads and Tails when coin A is tossed)= <strong>0.71<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><strong>q <\/strong><strong><em>B<\/em><\/strong><strong><em>(1)<\/em><\/strong>= 11.7(total number of Heads when coin B is tossed)\/(11.7+8.4)(total number of Heads and Tails when coin B is tossed)=<strong>0.58<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Continuing and Completing the EM algorithm<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Now we have completed one iteration of the EM algorithm. We now continue the second iteration of the algorithm using the above new values of <strong>q<\/strong><strong><em>A<\/em><\/strong>&amp;<strong>q<\/strong> <strong><em>B<\/em><\/strong>. We continue the iterations until the values of <strong>q<\/strong><strong><em>A<\/em><\/strong>&amp;<strong>q<\/strong> <strong><em>B<\/em><\/strong> do not change from one iteration to the next. This happens in the 10th iteration for our example (shown in Figure 33.3) when the values <strong>q<\/strong><strong><em>A<\/em><\/strong>&amp;<strong>q<\/strong> <strong><em>B<\/em><\/strong> converge to values <strong>0.80<\/strong> and <strong>0.52<\/strong> respectively.<\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p><strong>33.6 Kmeans and EM algorithm<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">We can explain K means as an EM algorithm. First we initialize the k means (mk) of the Kmeans algorithm. In the E Step weassign each point to a Cluster and during the M Step given the Clusters we refine mean mkof each cluster k. This process is repeated until the change in means is small.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>33.6.1 Generating Data from Mixture of Gaussians<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Now we can replace the \u2018hard\u2019 clustering of K-means described above with \u2018soft\u2019 probabilistic assignments . Here we assume that each instance x is generated<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-723\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-159.png\" alt=\"\" width=\"397\" height=\"180\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-159.png 397w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-159-300x136.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-159-65x29.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-159-225x102.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-159-350x159.png 350w\" sizes=\"auto, (max-width: 397px) 100vw, 397px\" \/><\/p>\n<p style=\"text-align: center\"><strong>Figure 33.5 The Gaussian Distributions used to Generate Data<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-724\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-160.png\" alt=\"\" width=\"579\" height=\"240\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-160.png 579w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-160-300x124.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-160-65x27.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-160-225x93.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-160-350x145.png 350w\" sizes=\"auto, (max-width: 579px) 100vw, 579px\" \/><\/p>\n<p style=\"text-align: center\"><strong>Figure 33.6 The Use of a Mixture of Gaussians for Generating Data<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">by choosing one of the k Gaussians at random and generating an instance according to that Gaussian(Figure 33.5). This requires more parameters to be determined that would fit the data. Figure 33.6 shows the probability of generating data p(X). This probability is based on the Gaussian distributions used, the mean and the variance of the Gaussian distributions and the mixing coefficients used. The sum of the mixing coefficients of all the Gaussian distributions use must be 1.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><strong style=\"text-align: initial;font-size: 1em\">33.6.2 K-means and Mixture of Gaussians<\/strong><\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Now we know that in a general K-means which is essentially a classifier and we need to find the parameterto fit data \u2013 that is we need to find the mean &#8211; \u00b5<em>k<\/em> as already discussed above. However when we use mixture of Gaussians which is a probability model where we are defining a \u201csoft\u201d classifier. Now the parameters that are to be determined to fit to data are the means \u00b5<em>k<\/em><em>and c<\/em>ovariance \u03a3<em>k<\/em>which define the Gaussians distributions and the mixing coefficient \u03c0<em>k<\/em><em>.<\/em> Now given the data set, find the mixing coefficients, means and covariance. If we knew which component generated each data point, the maximum likelihood solution would involve fitting each component to the corresponding cluster . However our problem is that the data set is unlabelled or are hidden (Figure 33.7).<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-725\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-161.png\" alt=\"\" width=\"584\" height=\"209\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-161.png 584w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-161-300x107.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-161-65x23.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-161-225x81.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-161-350x125.png 350w\" sizes=\"auto, (max-width: 584px) 100vw, 584px\" \/><\/p>\n<p style=\"text-align: center\"><strong>Figure 33.7 K Means Scenario<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-726\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-162.png\" alt=\"\" width=\"584\" height=\"276\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-162.png 584w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-162-300x142.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-162-65x31.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-162-225x106.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-162-350x165.png 350w\" sizes=\"auto, (max-width: 584px) 100vw, 584px\" \/><\/p>\n<p><strong>Figure 33.8 K means with Initial Guess of Cluster Points 33.6.3 EM for Estimating k Means<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Figure 33.8 shows the scenario of K means the instances from X are generated by a mixture of k Gaussians with unknown means &lt;m1,\u2026,mk&gt; of the k Gaussians.Remember we do not know which instance xi was generated by\u00a0<span style=\"font-size: 1em;text-align: initial\">which Gaussian. Now we need to determine the maximum likelihood estimates of &lt;m1,\u2026,mk&gt;. Now let us define the full description of each instance as yi=&lt;xi,zi1,zi2&gt; where zij is 1 if xi generated by j-th Gaussian. In this case xiis observable but however zijis unobservable.<\/span><\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p><strong>33.6.4 EM for Gaussian Mixtures<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Here we initialize the Gaussian parameters mean mk, co-variance \u00e5 k and mixing coefficient pk.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>E Step:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">In the E Step we assign each point xn an assignment score g(znk) for each cluster or Gaussian kwhich essentially indicates how much this Gaussian k is responsible for point Xn<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-727\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-163.png\" alt=\"\" width=\"405\" height=\"146\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-163.png 405w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-163-300x108.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-163-65x23.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-163-225x81.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-163-350x126.png 350w\" sizes=\"auto, (max-width: 405px) 100vw, 405px\" \/><\/p>\n<p style=\"text-align: center\"><strong>Figure 33.9 Calculation of Assignment Score<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Here g(znk) is calculated as the mean and covariance of the Gaussian distribution corresponding to the kth mean multiplied by mixture coefficient of kth distribution divided by the summation of mean and covariance of all the Gaussian distributions multiplied by their corresponding mixture coefficient.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>M step<\/strong><\/p>\n<p style=\"text-align: justify\">During the M Step, given scores, adjust mk, \u00e5 k, pk for each cluster kor Gaussian K. We update parameters using new g(znk) that is find the parameters that fit the new assignment score g(znk) the best. The new values of each of the parameters mknew , \u00e5 knew and pknew are determined as shown in Figure 33.10.<\/p>\n<\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-728\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-164.png\" alt=\"\" width=\"588\" height=\"197\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-164.png 588w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-164-300x101.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-164-65x22.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-164-225x75.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-164-350x117.png 350w\" sizes=\"auto, (max-width: 588px) 100vw, 588px\" \/><\/p>\n<p style=\"text-align: center\"><strong>Figure 33.10 Calculating new Values of Parameters during M Step<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Now we evaluate log likelihood as shown in Figure 33.11 . If likelihood or parameters converge we stop else we iterate with the E and M steps.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-729\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-165.png\" alt=\"\" width=\"497\" height=\"98\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-165.png 497w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-165-300x59.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-165-65x13.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-165-225x44.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-165-350x69.png 350w\" sizes=\"auto, (max-width: 497px) 100vw, 497px\" \/><\/p>\n<p style=\"text-align: center\"><strong>Figure 33.11 Evaluation of Log Likelihood<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><strong>33.7 Strengths of EM<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The major strength of the EM algorithm is its numerical stability where in every iteration of the EM algorithm, the likelihood of the observed data increases that is we are heading towards a solution. In addition, the EM handles parameter constraints gracefully.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>33.8 Problems with EM<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">In the case of EM algorithms can converge very slowly on some problems and this convergence is intimately related to the amount of missing information.It guarantees to improve the probability of the training corpus, which is different from reducing the errors directly. The EM algorithm cannot guarantee to reach global maximum and sometimes could get struck at the local maxima, saddle points, etc. Essentially the guess we make of the initial parameter values is very important and can decide on the time to converge.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Summary<\/strong><\/p>\n<ul>\n<li>Explained the concept of Expectation Maximization (EM)<\/li>\n<li>Discussed EM using a Coin Toss Example<\/li>\n<li>Outlined the use of EM in K-means Algorithm<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>you can view video on Expectation and Maximization<\/strong><\/td>\n<td><a href=\"https:\/\/youtu.be\/8xgj4b_UY8Y\" 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>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><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>S. Abu-Mostafa, M. Magdon-Ismail, and H.-T. Lin, \u201cLearning from Data\u201d, AMLBook, 2012.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n","protected":false},"author":3,"menu_order":32,"template":"","meta":{"_acf_changed":false,"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":[],"pb_section_license":""},"chapter-type":[],"contributor":[],"license":[],"class_list":["post-712","chapter","type-chapter","status-publish","hentry"],"part":3,"_links":{"self":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/pressbooks\/v2\/chapters\/712","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\/712\/revisions"}],"predecessor-version":[{"id":734,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/pressbooks\/v2\/chapters\/712\/revisions\/734"}],"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\/712\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/wp\/v2\/media?parent=712"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/pressbooks\/v2\/chapter-type?post=712"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/wp\/v2\/contributor?post=712"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/wp\/v2\/license?post=712"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}