
6.3 Recognition and Training 153
Before we proceed, each string will be converted to a sequence of symbol IDs and stored in a ne w cell
array, NumericData. This is convenient because, from an implementation point of view, it is easier to
work with numbers. Assuming that 1 stands for head s and 2 for tails, type
L=length(TrainingData);
for i=1:L
for j=1:length(TrainingData{i})
if TrainingData{i}(j)=='H'
NumericData{i}(j)=1;
else
NumericData{i}(j)=2;
end
end
end
Next, initialize the HMM with the first set of values. Type
pi_init_1 = [0.6 0.4]';
A_init_1 = [0.6 0.4; 0.6 0.4];
B_init_1 = [0.6 0.2; 0.4 0.8];
Then use function MultSeqTrainDoHMMBWsc to train the HMM ...