viterbi | R Documentation |
The Viterbi-algorithm computes the most probable path of states for a sequence of observations for a given Hidden Markov Model.
viterbi(hmm, observation)
hmm |
A Hidden Markov Model. |
observation |
A sequence of observations. |
Dimension and Format of the Arguments.
A valid Hidden Markov Model, for example instantiated by initHMM
.
A vector of observations.
Return Value:
viterbiPath |
A vector of strings, containing the most probable path of states. |
Lin Himmelmann <hmm@linhi.com>, Scientific Software Development
Lawrence R. Rabiner: A Tutorial on Hidden Markov Models and Selected Applications in Speech Recognition. Proceedings of the IEEE 77(2) p.257-286, 1989.
# Initialise HMM hmm = initHMM(c("A","B"), c("L","R"), transProbs=matrix(c(.6,.4,.4,.6),2), emissionProbs=matrix(c(.6,.4,.4,.6),2)) print(hmm) # Sequence of observations observations = c("L","L","R","R") # Calculate Viterbi path viterbi = viterbi(hmm,observations) print(viterbi)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.