comparison toolboxes/FullBNT-1.0.7/bnt/examples/dynamic/Old/online2.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 N = 1; % regular HMM
2 Q = 2;
3 ss = 2;
4 hnodes = 1;
5 onodes = 2;
6
7 rand('state', 0);
8 randn('state', 0);
9 O = 2;
10 discrete_obs = 1;
11 bnet = mk_chmm(N, Q, O, discrete_obs);
12 ns = bnet.node_sizes_slice;
13
14 engine = hmm_inf_engine(bnet, onodes);
15
16 T = 4;
17 ev = cell(ss,T);
18 ev(onodes,:) = num2cell(sample_discrete([0.5 0.5], N, T));
19
20
21 engine = dbn_init_bel(engine);
22 for t=1:T
23 if t==1
24 [engine, ll(t)] = dbn_update_bel1(engine, ev(:,t));
25 else
26 [engine, ll(t)] = dbn_update_bel(engine, ev(:,t-1:t));
27 end
28 % one-step ahead prediction
29 lag = 1;
30 engine2 = dbn_predict_bel(engine, lag);
31 marg = dbn_marginal_from_bel(engine2, 1)
32 marg = dbn_marginal_from_bel(engine2, 2)
33 end