# Maximum Entropy Markov Model Calculations

I am new to ML and I'm having trouble figuring out how to implement a Maximum Entropy Markov Model for a sequence labeling task. Given this MEMM equation $$P_{s'}(s|,o)=\frac{1}{Z(o,s')}\exp\left(\sum_{a}\lambda_{a}f_{a}(o,s)\right)$$ Where $s'$ is the previous classification, $s$ is the current classification, and $o$ is the current observaton.

And the following data

+--------+-----+
| The    | DT  |
| book   | NN  |
| I      | PRP |
| was    | V   |
| pretty | JJ  |
| good   | JJ  |
| .      | .   |
| I      | PRP |
| told   | V   |
| him    | PRP |
| to     | TO  |
| book   | V   |
| me     | PRP |
| a      | DT  |
| flight | NN  |
| .      | .   |
| Could  | MD  |
| I      | PRP |
| borrow | V   |
| book   | NN  |
| ?      | ?   |
+--------+-----+


What are the steps involved for calculating the $Z$ factor of $P(NN|\text{book}, DT)$?

$$Z=\sum_{C}p(c|x)=\sum_{c'\in C}\exp\left(\sum_{i=0}^{N}w_{c'i}f_{i}\right)$$

Assume all feature weights to be 1 and all feature functions to be binary indicators of the presence of both strings.

My confusion comes from the first series symbol in the $Z$ factor equation, which appears to ask us to take the sum of the exponents of all potential previous classifications and not just the particular one provided.

• Hi and welcome to the site, GrantD71! I have tried to incorporate the equations into your question, please make sure that they are still correct. Further: Your data are displayed quite messy, could you please re-format them so that they are easier to read? – COOLSerdash Jul 9 '13 at 21:18
• Thanks for the help incorporating the equations! I did my best to tidy up the data. – GrantD71 Jul 9 '13 at 21:29