Estimate Hidden Markov Processes from Data

Estimate a two-state hidden Markov process with three possible emission values from the given data.

 In[1]:= Xdata = TemporalData[Automatic, {CompressedData[" 1:eJxNk9t1wzAMQwNwhg7QFTpKR8gC3f+vIi7k1ic5lig+AAj+fP98v/16vb7O /+P8zSPr/OzJY81oo7vR9PCsNrRnRE3O1s92mM05z5C1tbvbjF15GHX2e5KS tHR67SlNZ9Mn3RZM5tyahbjHG9i4xAymczhZpMckpJYrjdySTRAT1JH/ktJO YZSCkCUO5YbCL1AFViEMnAbOISJQgQWRjYx/+ClEnUcXRoZ0ssbNhHBguEKF k5CviIVw8BggyKA1bEoZ8W7fueow+d4FEAJYIo86UOKGqSLgq6y6ja5psrhO CVSnN+bDAu3sDvUVO15FJnijQm4Px7pG5B56xdKDcLj6egkV7atKd3M7U1Qz 9u15uNnFpfo708u9KgY0KdjLc0XBgyFZY/aTofTKz91W3+cjmqLmVf16l3Vf ptRFV2rfu43UJVMFT+wX64AKKw== "], {{0, 20, 1}}, 50, {"Discrete", 50}, { "Discrete", 1}, 1, {ValueDimensions -> 1, MetaInformation -> {}}}, False, 10.];
 In[2]:= Xhmm = EstimatedProcess[data, HiddenMarkovProcess[2, 3]]
 Out[2]=

Compute the loglikelihood for the data under the estimated process.

 In[3]:= XLogLikelihood[hmm, data]
 Out[3]=

Estimate a two-state process with continuous emissions.

The overlaid histograms for each path suggest Gaussian emissions.

 In[5]:= XHistogram[data, Automatic, "PDF", PlotTheme -> "Monochrome"]
 Out[5]=

Compare the results from the default BaumWelch method and Viterbi training.

 In[6]:= XeprocBW = EstimatedProcess[data, HiddenMarkovProcess[2, "Gaussian"]]
 Out[6]=
 In[7]:= XeprocVT = EstimatedProcess[data, HiddenMarkovProcess[2, "Gaussian"], ProcessEstimator -> "ViterbiTraining"]
 Out[7]=

The data has higher loglikelihood with the BaumWelch estimated process.

 In[8]:= XLogLikelihood[#, data] & /@ {eprocBW, eprocVT}
 Out[8]=

Mathematica + Mathematica Online

Questions? Comments? Contact a Wolfram expert »