Dynamic Programming Viterbi - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

Dynamic Programming Viterbi

Description:

RB. JJ ... e -- RB 0.8 (1.0x0.8) Input sequence / time. very very -- quick. very ... RB JJ -- JJ 0.04536 (0.056x0.9x0.9) RB RB -- JJ 0.12096 (0.192x0.7x 0.9) ... – PowerPoint PPT presentation

Number of Views:64
Avg rating:3.0/5.0
Slides: 18
Provided by: facultyWa4
Category:

less

Transcript and Presenter's Notes

Title: Dynamic Programming Viterbi


1
Dynamic ProgrammingViterbi
2
Today
  • Take a look at dynamic programming algorithms
  • Walk through some examples
  • Simple chart parse
  • Viterbi example (from speech)
  • Viterbi example (from POS tagging)

3
Dynamic Programming
  • Definition Algorithmic approach for solving
    optimization problems by caching sub-problem
    solutions rather than recomputing them.
  • Typical device used is a chart to hold the
    various sub-problem solutions.
  • Common implementation Charts used in parsing
    (based on the Earley algorithm)

4
BU Chart Parser Walk Through
Sample Sentence The large can can hold the
water.
Sample Grammar
1. S ? NP VP 2. NP ? D ADJ N 3. NP ? D N 4. NP ?
ADJ N 5. VP ? AUX VP 6. VP ? V NP
5
Chart Parser
  • Allows one to preserve the results of the parse
    so far in a chart
  • Partial results and all previous results are kept
    so that work is not repeated

6
1. S ? NP VP 2. NP ? D ADJ N 3. NP ? D N 4. NP ?
ADJ N 5. VP ? AUX VP 6. VP ? V NP
The large can can hold the water.
D1
ADJ1
1
2
3
NP ? D ADJ N
NP ? D ADJ N
NP ? D N
NP ? ADJ N
7
1. S ? NP VP 2. NP ? D ADJ N 3. NP ? D N 4. NP ?
ADJ N 5. VP ? AUX VP 6. VP ? V NP
The large can can hold the water.
NP2
NP1
N1
D1
ADJ1
AUX1 - V1
1
2
3
4
NP ? D ADJ N
NP ? D ADJ N
NP ? D ADJ N
NP ? D N
NP ? ADJ N
NP ? ADJ N
S ? NP VP
S ? NP VP
8
Viterbi Example
See word models, p. 245
9
Viterbi Example
10
Viterbi example
  • Input is aa n iy dh ax
  • I need the
  • Actually dialectal/fast speech variant, Ah nee
    the
  • a ni ð?

11
aa n iy dh ax
12
Viterbi Example
13
A smaller example
very
quick
very
quick
0.1
0.9
0.8
0.2
0.7
end
start
JJ
RB
1
1
0.1
0.3
0.9
  • What is the best sequence of states for the input
    string very very quick?
  • Computing all possible paths and finding the one
    with maximum prob. is exponential

14
quick
very
very
quick
0.1
0.9
0.8
0.2
0.7
end
start
JJ
RB
1
1
0.1
0.3
0.9
Input sequence / time Input sequence / time Input sequence / time Input sequence / time
e --gt very very --gt very very very --gt quick
e --gt RB 0.8 (1.0x0.8)

e --gt JJ 0.0 (0x0.8)

15
quick
very
very
quick
0.1
0.9
0.8
0.2
0.7
end
start
JJ
RB
1
1
0.1
0.3
0.9
Input sequence / time Input sequence / time Input sequence / time Input sequence / time
e --gt very very --gt very very very --gt quick
e --gt RB 0.6 (1.0x0.8) RB --gt RB 0.192 (0.8x0.3x0.8)

e --gt JJ 0.0 (0x0.8) RB --gt JJ 0.056 (0.8x0.7x0.1)

16
quick
very
very
quick
0.1
0.9
0.8
0.2
0.7
end
start
JJ
RB
1
1
0.1
0.3
0.9
Input sequence Input sequence Input sequence Input sequence
e --gt very very --gt very very very --gt quick
e --gt RB 0.6 (1.0x0.8) RB --gt RB 0.192 (0.8x0.3x0.8) RB RB --gt RB 0.01152 (0.192x0.3x0.2)
RB RB --gt JJ 0.12096 (0.192x0.7x 0.9)
e --gt JJ 0.0 (0x0.8) RB --gt JJ 0.056 (0.8x0.7x0.8) RB JJ --gt RB 0.001122 (0.056x0.1x0.2)
RB JJ --gt JJ 0.04536 (0.056x0.9x0.9)
17
Implementation
// Initialize viterbi1,PERIOD 1.0 at the
start, assuming dummy period for i1 to n step 1
do // all input words (presumably in a sentence)
for all tags tj do // for all possible
tags // max probability of being in state j (tag
j) at word i1 (path probability
matrix) viterbii1,tj max1kT(viterbii,tk
x P(wi1tj) x P(tj tk)) // most likely
state (tag) at word i given that were in state j
at word i1 // In other words, statei1 is
keeping a pointer to the state that got us here
statei1,tj argmax1kT ( viterbii,tk x
P(wi1tj) x P(tj tk)) end end //Termination
and path-readout bestPathn1 argmax1jT
viterbin1,j for jn to 1 step -1 do // for
all input words bestPathj statei1,
bestPathj1 end P(bestPath1,, bestPathn )
max1jT viterbin1,j
Emission probability
State transition probability
Write a Comment
User Comments (0)
About PowerShow.com