title: Expectation Maximization coin toss examples
body: <p>I've been self-studying the Expectation Maximization lately, and grabbed myself some simple examples in the process:</p>
  
  <p><a href="http://cs.dartmouth.edu/~cs104/CS104_11.04.22.pdf" rel="noreferrer">http://cs.dartmouth.edu/~cs104/CS104_11.04.22.pdf</a>
  There are 3 coins 0, 1 and 2 with P0, P1 and P2 probability landing on Head when tossed. Toss coin 0, if the result is Head, toss coin 1 three times else toss coin 2 three times. The observed data produced by coin 1 and 2 is like this: HHH, TTT, HHH, TTT, HHH. The hidden data is coin 0's result. Estimate P0, P1 and P2.</p>
  
  <p><a href="http://ai.stanford.edu/~chuongdo/papers/em_tutorial.pdf" rel="noreferrer">http://ai.stanford.edu/~chuongdo/papers/em_tutorial.pdf</a>
  There are two coins A and B with PA and PB being the probability landing on Head when tossed. Each round, select one coin at random and toss it 10 times then record the results. The observed data is the toss results provided by these two coins. However, we don't know which coin was selected for a particular round. Estimate PA and PB.</p>
  
  <p>While I can get the calculations, I can't relate the ways they are solved to the original EM theory. Specifically, during the M-Step of both examples, I don't see how they're maximizing anything. It just seems they are recalculating the parameters and somehow, the new parameters are better than the old ones. Moreover, the two E-Steps don't even look similar to each other, not to mention the original theory's E-Step.</p>
  
  <p>So how exactly do these example work?</p>