<s>
The	O
Viterbi	B-Algorithm
algorithm	I-Algorithm
is	O
a	O
dynamic	B-Algorithm
programming	I-Algorithm
algorithm	O
for	O
obtaining	O
the	O
maximum	B-General_Concept
a	I-General_Concept
posteriori	I-General_Concept
probability	I-General_Concept
estimate	I-General_Concept
of	O
the	O
most	O
likely	O
sequence	O
of	O
hidden	O
states	O
—	O
called	O
the	O
Viterbi	B-Algorithm
path	I-Algorithm
—	O
that	O
results	O
in	O
a	O
sequence	O
of	O
observed	O
events	O
,	O
especially	O
in	O
the	O
context	O
of	O
Markov	O
information	O
sources	O
and	O
hidden	O
Markov	O
models	O
(	O
HMM	O
)	O
.	O
</s>
<s>
The	O
algorithm	O
has	O
found	O
universal	O
application	O
in	O
decoding	O
the	O
convolutional	B-Error_Name
codes	I-Error_Name
used	O
in	O
both	O
CDMA	B-Protocol
and	O
GSM	O
digital	O
cellular	O
,	O
dial-up	O
modems	O
,	O
satellite	O
,	O
deep-space	O
communications	O
,	O
and	O
802.11	O
wireless	O
LANs	O
.	O
</s>
<s>
It	O
is	O
now	O
also	O
commonly	O
used	O
in	O
speech	B-Application
recognition	I-Application
,	O
speech	B-Application
synthesis	I-Application
,	O
diarization	B-Application
,	O
keyword	O
spotting	O
,	O
computational	O
linguistics	O
,	O
and	O
bioinformatics	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
speech-to-text	B-Application
(	O
speech	B-Application
recognition	I-Application
)	O
,	O
the	O
acoustic	O
signal	O
is	O
treated	O
as	O
the	O
observed	O
sequence	O
of	O
events	O
,	O
and	O
a	O
string	O
of	O
text	O
is	O
considered	O
to	O
be	O
the	O
"	O
hidden	O
cause	O
"	O
of	O
the	O
acoustic	O
signal	O
.	O
</s>
<s>
The	O
Viterbi	B-Algorithm
algorithm	I-Algorithm
finds	O
the	O
most	O
likely	O
string	O
of	O
text	O
given	O
the	O
acoustic	O
signal	O
.	O
</s>
<s>
The	O
Viterbi	B-Algorithm
algorithm	I-Algorithm
is	O
named	O
after	O
Andrew	O
Viterbi	O
,	O
who	O
proposed	O
it	O
in	O
1967	O
as	O
a	O
decoding	O
algorithm	O
for	O
convolutional	B-Error_Name
codes	I-Error_Name
over	O
noisy	O
digital	O
communication	O
links	O
.	O
</s>
<s>
It	O
has	O
,	O
however	O
,	O
a	O
history	O
of	O
multiple	O
invention	O
,	O
with	O
at	O
least	O
seven	O
independent	O
discoveries	O
,	O
including	O
those	O
by	O
Viterbi	O
,	O
Needleman	B-Algorithm
and	I-Algorithm
Wunsch	I-Algorithm
,	O
and	O
Wagner	O
and	O
Fischer	O
.	O
</s>
<s>
It	O
was	O
introduced	O
to	O
Natural	B-Language
Language	I-Language
Processing	I-Language
as	O
a	O
method	O
of	O
part-of-speech	O
tagging	O
as	O
early	O
as	O
1987	O
.	O
</s>
<s>
Viterbi	B-Algorithm
path	I-Algorithm
and	O
Viterbi	B-Algorithm
algorithm	I-Algorithm
have	O
become	O
standard	O
terms	O
for	O
the	O
application	O
of	O
dynamic	B-Algorithm
programming	I-Algorithm
algorithms	O
to	O
maximization	O
problems	O
involving	O
probabilities	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
statistical	B-General_Concept
parsing	I-General_Concept
a	O
dynamic	B-Algorithm
programming	I-Algorithm
algorithm	O
can	O
be	O
used	O
to	O
discover	O
the	O
single	O
most	O
likely	O
context-free	O
derivation	O
(	O
parse	O
)	O
of	O
a	O
string	O
,	O
which	O
is	O
commonly	O
called	O
the	O
"	O
Viterbi	O
parse	O
"	O
.	O
</s>
<s>
Another	O
application	O
is	O
in	O
target	B-Application
tracking	I-Application
,	O
where	O
the	O
track	O
is	O
computed	O
that	O
assigns	O
a	O
maximum	O
likelihood	O
to	O
a	O
sequence	O
of	O
observations	O
.	O
</s>
<s>
A	O
generalization	O
of	O
the	O
Viterbi	B-Algorithm
algorithm	I-Algorithm
,	O
termed	O
the	O
max-sum	O
algorithm	O
(	O
or	O
max-product	O
algorithm	O
)	O
can	O
be	O
used	O
to	O
find	O
the	O
most	O
likely	O
assignment	O
of	O
all	O
or	O
some	O
subset	O
of	O
latent	O
variables	O
in	O
a	O
large	O
number	O
of	O
graphical	O
models	O
,	O
e.g.	O
</s>
<s>
Bayesian	O
networks	O
,	O
Markov	O
random	O
fields	O
and	O
conditional	B-General_Concept
random	I-General_Concept
fields	I-General_Concept
.	O
</s>
<s>
The	O
general	O
algorithm	O
involves	O
message	O
passing	O
and	O
is	O
substantially	O
similar	O
to	O
the	O
belief	O
propagation	O
algorithm	O
(	O
which	O
is	O
the	O
generalization	O
of	O
the	O
forward-backward	B-Algorithm
algorithm	I-Algorithm
)	O
.	O
</s>
<s>
With	O
the	O
algorithm	O
called	O
iterative	B-Error_Name
Viterbi	I-Error_Name
decoding	I-Error_Name
one	O
can	O
find	O
the	O
subsequence	O
of	O
an	O
observation	O
that	O
matches	O
best	O
(	O
on	O
average	O
)	O
to	O
a	O
given	O
hidden	O
Markov	O
model	O
.	O
</s>
<s>
to	O
deal	O
with	O
turbo	B-Error_Name
code	I-Error_Name
.	O
</s>
<s>
Iterative	B-Error_Name
Viterbi	I-Error_Name
decoding	I-Error_Name
works	O
by	O
iteratively	O
invoking	O
a	O
modified	O
Viterbi	B-Algorithm
algorithm	I-Algorithm
,	O
reestimating	O
the	O
score	O
for	O
a	O
filler	O
until	O
convergence	O
.	O
</s>
<s>
An	O
alternative	O
algorithm	O
,	O
the	O
Lazy	O
Viterbi	B-Algorithm
algorithm	I-Algorithm
,	O
has	O
been	O
proposed	O
.	O
</s>
<s>
For	O
many	O
applications	O
of	O
practical	O
interest	O
,	O
under	O
reasonable	O
noise	O
conditions	O
,	O
the	O
lazy	O
decoder	O
(	O
using	O
Lazy	O
Viterbi	B-Algorithm
algorithm	I-Algorithm
)	O
is	O
much	O
faster	O
than	O
the	O
original	O
Viterbi	O
decoder	O
(	O
using	O
Viterbi	B-Algorithm
algorithm	I-Algorithm
)	O
.	O
</s>
<s>
While	O
the	O
original	O
Viterbi	B-Algorithm
algorithm	I-Algorithm
calculates	O
every	O
node	O
in	O
the	O
trellis	O
of	O
possible	O
outcomes	O
,	O
the	O
Lazy	O
Viterbi	B-Algorithm
algorithm	I-Algorithm
maintains	O
a	O
prioritized	O
list	O
of	O
nodes	O
to	O
evaluate	O
in	O
order	O
,	O
and	O
the	O
number	O
of	O
calculations	O
required	O
is	O
typically	O
fewer	O
(	O
and	O
never	O
more	O
)	O
than	O
the	O
ordinary	O
Viterbi	B-Algorithm
algorithm	I-Algorithm
for	O
the	O
same	O
result	O
.	O
</s>
<s>
transition	B-Algorithm
matrix	I-Algorithm
of	O
size	O
such	O
that	O
stores	O
the	O
transition	O
probability	O
of	O
transiting	O
from	O
state	O
to	O
state	O
,	O
</s>
<s>
Restated	O
in	O
a	O
succinct	O
near-Python	O
:	O
</s>
<s>
The	O
Viterbi	B-Algorithm
path	I-Algorithm
can	O
be	O
retrieved	O
by	O
saving	O
back	O
pointers	O
that	O
remember	O
which	O
state	O
was	O
used	O
in	O
the	O
second	O
equation	O
.	O
</s>
<s>
Then	O
using	O
amortized	B-General_Concept
analysis	I-General_Concept
one	O
can	O
show	O
that	O
the	O
complexity	O
is	O
,	O
where	O
is	O
the	O
number	O
of	O
edges	O
in	O
the	O
graph	O
.	O
</s>
<s>
The	O
observations	O
(	O
normal	O
,	O
cold	O
,	O
dizzy	O
)	O
along	O
with	O
a	O
hidden	O
state	O
(	O
healthy	O
,	O
fever	O
)	O
form	O
a	O
hidden	O
Markov	O
model	O
(	O
HMM	O
)	O
,	O
and	O
can	O
be	O
represented	O
as	O
follows	O
in	O
the	O
Python	B-Language
programming	I-Language
language	I-Language
:	O
</s>
<s>
This	O
is	O
answered	O
by	O
the	O
Viterbi	B-Algorithm
algorithm	I-Algorithm
.	O
</s>
<s>
trellis	B-Error_Name
diagram	I-Error_Name
.	O
</s>
<s>
The	O
soft	O
output	O
Viterbi	B-Algorithm
algorithm	I-Algorithm
(	O
SOVA	O
)	O
is	O
a	O
variant	O
of	O
the	O
classical	O
Viterbi	B-Algorithm
algorithm	I-Algorithm
.	O
</s>
<s>
SOVA	O
differs	O
from	O
the	O
classical	O
Viterbi	B-Algorithm
algorithm	I-Algorithm
in	O
that	O
it	O
uses	O
a	O
modified	O
path	O
metric	O
which	O
takes	O
into	O
account	O
the	O
a	O
priori	O
probabilities	O
of	O
the	O
input	O
symbols	O
,	O
and	O
produces	O
a	O
soft	O
output	O
indicating	O
the	O
reliability	O
of	O
the	O
decision	O
.	O
</s>
<s>
This	O
cost	O
is	O
accumulated	O
over	O
the	O
entire	O
sliding	O
window	O
(	O
usually	O
equals	O
at	O
least	O
five	O
constraint	B-Error_Name
lengths	I-Error_Name
)	O
,	O
to	O
indicate	O
the	O
soft	O
output	O
measure	O
of	O
reliability	O
of	O
the	O
hard	O
bit	O
decision	O
of	O
the	O
Viterbi	B-Algorithm
algorithm	I-Algorithm
.	O
</s>
