Natural Language Processing · M2 · read

A path score is not the probability of the observed sentence

Choosing the most likely tag sequence

Unit 4 page 73: Viterbi motivation, explained with small worked extensions

Question. An HMM has π(H)=0.8, π(C)=0.2; transitions H:(0.7,0.3), C:(0.4,0.6); emissions H:(0.2,0.4,0.4), C:(0.5,0.4,0.1) for labels1,2,3. For observations 1,3, calculate the probability of the observations by summing all four two-state paths.

Given

Initial probabilities: π(H)=0.8, π(C)=0.2. Transition matrix: H→H=0.7, H→C=0.3, C→H=0.4, C→C=0.6. Emissions for labels (1,2,3): H=(0.2,0.4,0.4), C=(0.5,0.4,0.1). There is no END-state factor.

To find

P(observations 1,3), not just the best-path score.

Formula and why it applies

P(o_1,o_2)=\sum_{s_1,s_2}\pi_{s_1}b_{s_1}(o_1)a_{s_1s_2}b_{s_2}(o_2)LaTeX: P(o_1,o_2)=\sum_{s_1,s_2}\pi_{s_1}b_{s_1}(o_1)a_{s_1s_2}b_{s_2}(o_2)

The hidden path is unspecified, so its mutually exclusive alternatives must be summed.

Solution

Step 1. Score H,H
0.8(0.2)(0.7)(0.4)=0.0448LaTeX: 0.8(0.2)(0.7)(0.4)=0.0448
Step 2. Score H,C
0.8(0.2)(0.3)(0.1)=0.0048LaTeX: 0.8(0.2)(0.3)(0.1)=0.0048
Step 3. Score C,H
0.2(0.5)(0.4)(0.4)=0.016LaTeX: 0.2(0.5)(0.4)(0.4)=0.016
Step 4. Score C,C
0.2(0.5)(0.6)(0.1)=0.006LaTeX: 0.2(0.5)(0.6)(0.1)=0.006
Step 5. Add all paths
P(1,3)=0.0448+0.0048+0.016+0.006=0.0716LaTeX: P(1,3)=0.0448+0.0048+0.016+0.006=0.0716
Final answer. Observation probability =0.0716. The best single-path score 0.0448 is a different quantity.

If asked for the posterior of path H,H given observations 1,3, normalize: 0.0448/0.0716 ≈0.625698. Viterbi chooses the best path using joint scores because the observation denominator is common to every candidate. It does not compute that denominator by taking a maximum.

HMM Path Probabilities

id
nlp-m2-09-hmm-joint-paths
title
HMM Path Probabilities
title_confirmed
true
topic_title
Complete HMM path scores and observation probabilities
mode
m2
kind
focused
status
available
duration
8:34
reviewed
false
notebook_url
https://notebook.google.com/notebook/a270ef1e-c285-4d31-9db1-302090c5f8b1
youtube_url
corrected_visuals
false
upload_pending_correction
false
correction_note
related_topic_ids

    These are recorded generation statuses, not a live service check. Private YouTube and signed-in NotebookLM links require the owner's account. This export publishes existing catalog metadata, not private video files or an invented transcript.

    NLP M2 — HMM and Viterbi | Reviewed worked numericals

    id
    overview-hmm-viterbi
    title
    NLP M2 — HMM and Viterbi | Reviewed worked numericals
    title_confirmed
    true
    topic_title
    HMM Prob & Viterbi
    mode
    m2
    kind
    supplemental
    status
    available
    duration
    8:30
    reviewed
    true
    notebook_url
    https://notebook.google.com/notebook/a270ef1e-c285-4d31-9db1-302090c5f8b1
    youtube_url
    https://www.youtube.com/watch?v=RRuSfA_ZMhY
    corrected_visuals
    true
    upload_pending_correction
    false
    correction_note
    Complete HMM factors, all Viterbi candidate scores and backpointers; clarified zero emissions. Full transcript and detected slides checked; short voice corrections included.
    related_topic_ids
    • nlp-m2-08-markov-hmm-components
    • nlp-m2-09-hmm-joint-paths
    • nlp-m2-10-viterbi-decoding

    These are recorded generation statuses, not a live service check. Private YouTube and signed-in NotebookLM links require the owner's account. This export publishes existing catalog metadata, not private video files or an invented transcript.