HMM utility functions (RandomHMM, FloorHMM)

Define observable styles

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

Generate random HMM (left-to-right structure)

nStates = 3 ; nObservables = 5 ; structure = 1 ;

model2 = RandomHMM[nStates, nObservables, structure] ;

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

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

Generate random HMM (fully connected)

nStates = 5 ; nObservables = 5 ; structure = 0 ;

model2 = RandomHMM[nStates, nObservables, structure] ;

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

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

Flooring an HMM

Generate random model and floor it

model3 = RandomHMM[3, 4, 1] ; model4 = FloorHMM[model3, {1, 1, 1}, 10^-4] ;

Compare A matrices

model3[[1]] // TableForm

0.412036 0.21838 0.369583
0. 0.280547 0.719453
0. 0. 1.

model4[[1]] // TableForm

0.412036 0.21838 0.369583
0.00009999 0.280519 0.719381
0.00009998 0.00009998 0.9998

Created by Mathematica  (October 20, 2003)