Mercurial > hg > flst
view matlab/test_flst.m @ 0:1df4a6fb0d22
added flst files moved over from "smoothie"
author | matthiasm |
---|---|
date | Fri, 31 Oct 2014 10:52:27 +0800 |
parents | |
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