view matlab/test_flst.m @ 1:4283604499f8 tip

added mini probability to delta (not sure if this is a good idea, but I did it)
author matthiasm
date Mon, 10 Nov 2014 19:38:49 +0000
parents 1df4a6fb0d22
children
line wrap: on
line source
% TEST_FLST tests the fixed lag sparse transition Viterbi implementation

addpath('misc')
addpath('smoothiecore')
addpath('flst')

%% setup model

mdl = hmm_dummy();
memory = 3;
d = flstMakeData(mdl, memory);

%% now make up some probabilites

obsLik = [...
    [0.5, 0.5];
    [0.8, 0.2];
    [0.4, 0.6];
    [0.8, 0.2];
    [0.8, 0.2];
    [0.2, 0.8];
    [0.3, 0.7];
    [0.9, 0.1]]';

nFrame = size(obsLik,2);


for iFrame = 1:nFrame-1
    d = flstViterbiUpdate(obsLik(:,iFrame), d);
end
d = flstViterbiUpdate(obsLik(:,iFrame), d, 1);
e = d;
d = flstMakeData(mdl, memory);
disp(e)

%% test

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