Import examples (ReadHMM, ReadObservationSequences)

Set directory

SetDirectory["/Users/nechyba/www/eel6825/course_materials/t8.markov_systems/sample_data"] ;

Read sample HMM file

Import HMM model

model = ReadHMM["sample_hmm.hmm"] ;

A matrix

model[[1]] // TableForm

0.45196 0.54804 0. 0. 0.
0. 0.730837 0.269163 0. 0.
0. 0. 0.695162 0.304838 0.
0. 0. 0. 0.827637 0.172363
0. 0. 0. 0. 1.

B matrix

model[[2]] // TableForm

0. 0.141985 0. 0.00984415 0.0819263
0. 0. 0.115858 0. 0.0388862
0. 0.0253909 0.139865 0.853684 0.00645671
0. 0. 0.0220696 0.0270916 0.239491
1. 0.0558476 0. 0. 0.270867
0. 0. 0.3061 0.00492602 0.0129707
0. 0.77477 0.20795 0.0669995 0.0099643
0. 0.00200682 0.208157 0.0374546 0.339439

π vector

model[[3]] // TableForm

1.
0.
0.
0.
0.

Read sample observation sequence file

Import observation sequences

obs = ReadObservationSequences["sample_data.sym"] ;

Display observation sequences

TableForm[obs, TableSpacing1]

5 1 6 6 6 6 6 6 6 4 4 4 4 4 4 4 4 4 4 4 3 5 5 5
5 1 1 1 2 2 2 6 6 6 6 6 6 6 6 3 3 3 3 3 7 5 5
5 5 5 1 1 1 1 6 6 6 6 6 6 6 7 6 6 6 6 6 1 5
5 1 7 7 7 3 4 8 8 2 2 6 6 6 6 7 6 7 7 5 5
5 1 7 7 3 3 4 3 4 8 8 2 2 2 6 6 6 6 6 1 5 5
5 1 8 3 3 4 4 2 2 2 6 6 6 6 6 6 6 6 6 6 6 5 5 5
5 5 5 8 8 8 8 8 8 2 2 2 6 6 6 6 6 7 5 5 5
5 5 5 7 7 8 8 8 8 8 2 2 6 6 6 6 6 6 6 6 1 5
5 1 1 1 8 8 8 8 8 8 2 2 6 2 6 6 6 6 6 6 7 1 5 5
5 5 7 7 3 8 8 2 2 2 2 2 2 6 6 6 6 6 1 5 5 5
5 5 5 7 7 7 3 3 8 8 8 8 2 2 6 6 6 6 6 1 5 5
5 5 7 7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