annotate toolboxes/FullBNT-1.0.7/HMM/dhmm_sample_endstate.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function [obs, hidden] = dhmm_sample_endstate(startprob, transmat, obsmat, endprob, numex)
wolffd@0 2 % SAMPLE_DHMM Generate random sequences from an HMM with discrete outputs.
wolffd@0 3 % function [obs, hidden] = sample_dhmm_endstate(startprob, transmat, obsmat, endprob, numex)
wolffd@0 4 %
wolffd@0 5 % We sample until we have have entered the end state
wolffd@0 6 % obs{m} and hidden{m} are the m'th sequence
wolffd@0 7
wolffd@0 8 hidden = cell(1,numex);
wolffd@0 9 obs = cell(1,numex);
wolffd@0 10
wolffd@0 11 for m=1:numex
wolffd@0 12 hidden{m} = mc_sample_endstate(startprob, transmat, endprob);
wolffd@0 13 T = length(hidden{m});
wolffd@0 14 obs{m} = zeros(1,T);
wolffd@0 15 for t=1:T
wolffd@0 16 h = hidden{m}(t);
wolffd@0 17 obs{m}(t) = sample_discrete(obsmat(h,:));
wolffd@0 18 end
wolffd@0 19 end