Natural Language Processing · TEE · papers

Q6b · HMM tables and path

2024-02-12 · re-exam · recovered AI paper

Previous examination · complete worked answers

Question. For the four tagged sentences below construct transition and emission tables (3 marks each), then calculate Geeta/N will/M spot/V Rita/N using initial P(N)=0.5, P(M)=0.25, P(V)=0.25. [10 marks]

Answer

Given

SentenceGiven tags
Rita can teach WillN M V N
Spot will see WillN M V N
Will Rita spot GeetaN N V N
Geeta will pat SpotN M V N

Required path: Geeta will spot Rita / N M V N. Given initial probabilities: {'N': Fraction(1, 2), 'M': Fraction(1, 4), 'V': Fraction(1, 4)}

To find

Emission and transition tables and the specified tag-path joint probability

Formula: which one and why

P(w\mid t)=\frac{c(t,w)}{c(t)}LaTeX: P(w\mid t)=\frac{c(t,w)}{c(t)}
P(t_j\mid t_i)=\frac{c(t_i,t_j)}{\sum_kc(t_i,t_k)}LaTeX: P(t_j\mid t_i)=\frac{c(t_i,t_j)}{\sum_kc(t_i,t_k)}

The second formula is the declared no-END convention. Reset at sentence boundaries; never create a transition from the last word of one training sentence to the first of the next.

Step 1. Count emissions

TagTotal occurrencesRitacanteachWillSpotwillseespotGeetapat
N92003200020
M30100020000
V40010001101

Step 2. Divide each emission by its tag count

TagRitacanteachWillSpotwillseespotGeetapat
N2/9001/32/90002/90
M01/30002/30000
V001/40001/41/401/4

Step 3. Count transitions inside each sentence

FromOutgoing transitionsSentence-final countNMV
N54131
M30003
V40400

Step 4. Convert to a transition table

From / toNMV
N1/53/51/5
M001
V100

Here sentence-final tags are excluded from the no-END outgoing denominator. If END is explicitly modeled, divide all tag→tag and tag→END counts by the total tag count instead; the row then includes END. Do not mix denominators.

Step 5. Multiply the given path, in order

FactorProbabilityRunning product
Initial N1/21 × 1/2 = 1/2
Emit Geeta2/91/2 × 2/9 = 1/9
Transition N→M3/51/9 × 3/5 = 1/15
Emit will2/31/15 × 2/3 = 2/45
Transition M→V12/45 × 1 = 2/45
Emit spot1/42/45 × 1/4 = 1/90
Transition V→N11/90 × 1 = 1/90
Emit Rita2/91/90 × 2/9 = 1/405

Final answer

The two displayed probability tables are the estimated HMM. Zero means unobserved without smoothing, not logically impossible.

No-END path joint probability = 1/405 = 0.00246913580247. If a normalized END-state model is explicitly adopted instead, this complete terminated sequence has probability 4/6561 = 0.000609663161103. These are different model conventions, not contradictory answers.