Code covered by the BSD License

### Highlights from Forward Viterbi Algorithm

3.0
3.0 | 3 ratings Rate this file 12 Downloads (last 30 days) File Size: 1.83 KB File ID: #24516 Version: 1.1

# Forward Viterbi Algorithm

### David Conger (view profile)

22 Jun 2009 (Updated )

Forward Viterbi algorithm based on: http://en.wikipedia.org/wiki/Viterbi_algorithm

File Information
Description

Forward Viterbi algorithm based on the Python code found at: http://en.wikipedia.org/wiki/Viterbi_algorithm

Also included is an example based on the one from the Wikipedia page for a simple 2-state model with 4 observations. To paraphrase:

Bob tells Alice his daily activities (observations) and Alice wants to determine the most likely weather each day (states). Since Alice lives far away, the weather is unknown to her (hidden). Assuming that the states behave as a Markov process, and the observations have a statistical dependency on the states, the Viterbi algorithm can find the most likely weather pattern (path).

http://en.wikipedia.org/wiki/Viterbi_algorithm

MATLAB release MATLAB 7.5 (R2007b)
04 Aug 2010 Sam Ham

### Sam Ham (view profile)

The code works fine now, the previous bug was fixed, I just tested it.

04 Aug 2010 Sam Ham

### Sam Ham (view profile)

05 Nov 2009 Justin

### Justin (view profile)

foward_viterbi.m contains a bug not in the original python version. If the output is longer than 3 states then this line throws an error. The 2nd index to emit_p should be the position of the output token in the vector of possible output states, not the index into the observation vector.
p = emit_p(source_state,output) * trans_p(source_state,next_state);