Training example (TrainHMM)*

Define observable styles

styles = {Red, Green, Blue, Yellow, Cyan, Magenta, Orange, Black} ;

Initial model

initial = RandomHMM[3, 8, 1] ;

Visualize initial model

DrawHMM[initial[[1]], initial[[2]], HMMStyleSequential, AngularOffset->46 Degree, B ... Offset1, StateTextFalse, MarkovTextFalse, ObservableStylestyles] ;

[Graphics:../HTMLFiles/index_116.gif]

Training on sample observation sequences (slow)

training = TrainHMM[obs, initial, 30] ; final = training //Last ;

Visualize final model

DrawHMM[final[[1]], final[[2]], HMMStyleSequential, AngularOffset->46 Degree, BendA ... Offset1, StateTextFalse, MarkovTextFalse, ObservableStylestyles] ;

[Graphics:../HTMLFiles/index_119.gif]

Compare log probabilities of initial and final models

initialProb = Plus @@ (LogProb[#, initial] &/@obs)

RowBox[{-, 1740.14}]

finalProb = Plus @@ (LogProb[#, final] &/@obs)

RowBox[{-, 1131.75}]


Created by Mathematica  (October 20, 2003)