# Wolfram Language & System 11.0 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.
BUILT-IN WOLFRAM LANGUAGE SYMBOL

# HiddenMarkovProcess

HiddenMarkovProcess[i0,m,em]
represents a discrete-time, finite-state hidden Markov process with transition matrix m, emission matrix em, and initial hidden state i0.

HiddenMarkovProcess[,m,{dist1,}]
represents a hidden Markov process with emission distributions disti.

HiddenMarkovProcess[p0,m,]
represents a hidden Markov process with initial hidden state probability vector p0.

## DetailsDetails

• HiddenMarkovProcess is also known as a hidden Markov model or HMM.
• HiddenMarkovProcess is a discrete-time and discrete-state random process.
• A hidden Markov process has DiscreteMarkovProcess[p0,m] as an underlying hidden state transition process. The values observed from a hidden Markov process, called emissions, are random and follow emission distributions disti at state i. Emissions produced while visiting a given sequence of states are independent.
• The hidden states of HiddenMarkovProcess are integers between 1 and , where is the length of the transition matrix m.
• The transition matrix m specifies conditional hidden state transition probabilities mi,jProbability[x[k+1]jx[k]i], where x[k] is the hidden state of the process at time k.
• The emission matrix em specifies the probabilities for emissions at a given hidden state emi,rProbability[y[k]rx[k]i], where x[k] is the hidden state and y[k] is the emission at time k.
• The emission distributions disti must be all univariate or all multivariate, all discrete or all continuous.
• The emission distribution disti specifies that y[k]disti, given that x[k]i.
• A silent state that produces no emissions is represented by a row of zeros in the case of an emission matrix or by None for general emissions. Each silent state must have a path to an emitting state.
• For a hidden Markov process proc with silent states, HiddenMarkovProcess[proc] gives the effective process with silent states removed.
• EstimatedProcess[data,HiddenMarkovProcess[n,edist]] can be used to estimate an n state process with emission distributions in the family specified by edist.
• The following special edist templates can be used:
•  s s discrete emissions "Gaussian" Gaussian emissions dist emissions for all states distributed as dist {dist1,…,distn} emission distribution disti from state i
• EstimatedProcess accepts the following settings for ProcessEstimator:
•  Automatic automatically choose the parameter estimator "BaumWelch" maximize log-likelihood by expectation maximization "ViterbiTraining" decode most likely path and use supervised training "StateClustering" use clustering followed by supervised training "SupervisedTraining" estimation using both state and emission data
• The methods "BaumWelch", "ViterbiTraining", and "StateClustering" use no hidden state information, whereas "SupervisedTraining" relies on having access to state path data.
• Functions that work on data such as LogLikelihood accept Missing values.
• RandomFunction[HiddenMarkovProcess[]] gives only emissions by default. With Method->{"IncludeHiddenStates"->True}, it gives a TemporalData object td with the state sequence included as metadata. The hidden state data can be retrieved using td["HiddenStates"].
• HiddenMarkovProcess allows m to be an × matrix with non-negative elements and rows that sum to 1, em an × matrix with non-negative elements and rows that sum to 0 or 1, i0 an integer between 1 and , and p0 a vector of length of non-negative elements that sum to 1.
• HiddenMarkovProcess can be used with such functions as LogLikelihood, FindHiddenMarkovStates, EstimatedProcess, PDF, Probability, and RandomFunction.

## ExamplesExamplesopen allclose all

### Basic Examples  (2)Basic Examples  (2)

Define a hidden Markov process:

 In[1]:=

Simulate it:

 In[2]:=
 Out[2]=

Visualize the emissions:

 In[3]:=
 Out[3]=

Find the most likely hidden state sequence (Viterbi decode) from the given emissions:

 In[1]:=
 In[2]:=
 Out[2]=