comparison toolboxes/FullBNT-1.0.7/bnt/examples/dynamic/HHMM/pretty_print_hhmm_parse.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 function pretty_print_hhmm_parse(mpe, Qnodes, Fnodes, Onode, alphabet)
2 % function pretty_print_hhmm_parse(mpe, Qnodes, Fnodes, Onode, alphabet)
3 %
4 % mpe(i,t) is the most probable value of node i at time t
5 % Qnodes(1:D), Fnodes = [F2 .. FD], Onode contain the node ids
6 % alphabet(i) is the i'th output symbol, or [] if don't want displayed
7
8 T = size(mpe,2);
9 ncols = 20;
10 t1 = 1; t2 = min(T, t1+ncols-1);
11 while (t1 < T)
12 %fprintf('%d:%d\n', t1, t2);
13 if iscell(mpe)
14 print_block_cell(mpe(:,t1:t2), Qnodes, Fnodes, Onode, alphabet, t1);
15 else
16 print_block(mpe(:,t1:t2), Qnodes, Fnodes, Onode, alphabet, t1);
17 end
18 fprintf('\n\n');
19 t1 = t2+1; t2 = min(T, t1+ncols-1);
20 end
21
22 %%%%%%
23
24 function print_block_cell(mpe, Qnodes, Fnodes, Onode, alphabet, start)
25
26 D = length(Qnodes);
27 T = size(mpe, 2);
28 fprintf('%3d ', start:start+T-1); fprintf('\n');
29 for d=1:D
30 for t=1:T
31 if (d > 1) & (mpe{Fnodes(d-1),t} == 2)
32 fprintf('%3d|', mpe{Qnodes(d), t});
33 else
34 fprintf('%3d ', mpe{Qnodes(d), t});
35 end
36 end
37 fprintf('\n');
38 end
39 if ~isempty(alphabet)
40 a = cell2num(mpe(Onode,:));
41 %fprintf('%3c ', alphabet(mpe{Onode,:}));
42 fprintf('%3c ', alphabet(a))
43 fprintf('\n');
44 end
45
46
47 %%%%%%
48
49 function print_block(mpe, Qnodes, Fnodes, Onode, alphabet, start)
50
51 D = length(Qnodes);
52 T = size(mpe, 2);
53 fprintf('%3d ', start:start+T-1); fprintf('\n');
54 for d=1:D
55 for t=1:T
56 if (d > 1) & (mpe(Fnodes(d-1),t) == 2)
57 fprintf('%3d|', mpe(Qnodes(d), t));
58 else
59 fprintf('%3d ', mpe(Qnodes(d), t));
60 end
61 end
62 fprintf('\n');
63 end
64 if ~isempty(alphabet)
65 fprintf('%3c ', alphabet(mpe(Onode,:)));
66 fprintf('\n');
67 end