viterbi {HMM}R Documentation

Computes the Most Probable Path of States

Description

The Viterbi algorithm computes the most probable path of states for a sequence of observations given a Hidden Markov Model.

Usage

viterbi(hmm, observation)

Arguments

hmm

A valid Hidden Markov Model, for example instantiated by initHMM.

observation

A vector of observations.

Value

A vector of strings containing the most probable path of states.

Author(s)

Lin Himmelmann hmm@linhi.de

References

Lawrence R. Rabiner: A Tutorial on Hidden Markov Models and Selected Applications in Speech Recognition. Proceedings of the IEEE 77(2), pp. 257-286, 1989.

Examples

# 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)

[Package HMM version 1.0.2 Index]