To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Revision:

root / matlab / test_flst.m

History | View | Annotate | Download (714 Bytes)

1
% TEST_FLST tests the fixed lag sparse transition Viterbi implementation
2

    
3
addpath('misc')
4
addpath('smoothiecore')
5
addpath('flst')
6

    
7
%% setup model
8

    
9
mdl = hmm_dummy();
10
memory = 3;
11
d = flstMakeData(mdl, memory);
12

    
13
%% now make up some probabilites
14

    
15
obsLik = [...
16
    [0.5, 0.5];
17
    [0.8, 0.2];
18
    [0.4, 0.6];
19
    [0.8, 0.2];
20
    [0.8, 0.2];
21
    [0.2, 0.8];
22
    [0.3, 0.7];
23
    [0.9, 0.1]]';
24

    
25
nFrame = size(obsLik,2);
26

    
27

    
28
for iFrame = 1:nFrame-1
29
    d = flstViterbiUpdate(obsLik(:,iFrame), d);
30
end
31
d = flstViterbiUpdate(obsLik(:,iFrame), d, 1);
32
e = d;
33
d = flstMakeData(mdl, memory);
34
disp(e)
35

    
36
%% test
37

    
38
if all((e.path-[1 1 1 1 1 2 2 2])==0)
39
    fprintf(1, 'Test ok.\n');
40
else
41
    warning('Test has detected an error.')
42
end