Learn R Programming

mlpack (version 3.4.2)

hmm_viterbi: Hidden Markov Model (HMM) Viterbi State Prediction

Description

A utility for computing the most probable hidden state sequence for Hidden Markov Models (HMMs). Given a pre-trained HMM and an observed sequence, this uses the Viterbi algorithm to compute and return the most probable hidden state sequence.

Usage

hmm_viterbi(input, input_model, verbose = FALSE)

Arguments

input

Matrix containing observations (numeric matrix).

input_model

Trained HMM to use (HMMModel).

verbose

Display informational messages and the full list of parameters and timers at the end of execution. Default value "FALSE" (logical).

Value

A list with several components:

output

File to save predicted state sequence to (integer matrix).

Details

This utility takes an already-trained HMM, specified as "input_model", and evaluates the most probable hidden state sequence of a given sequence of observations (specified as '"input", using the Viterbi algorithm. The computed state sequence may be saved using the "output" output parameter.

Examples

Run this code
# NOT RUN {
# For example, to predict the state sequence of the observations "obs" using
# the HMM "hmm", storing the predicted state sequence to "states", the
# following command could be used:

# }
# NOT RUN {
output <- hmm_viterbi(input=obs, input_model=hmm)
states <- output$output
# }

Run the code above in your browser using DataLab