Mercurial > hg > camir-aes2014
annotate toolboxes/FullBNT-1.0.7/bnt/examples/dynamic/scg_dbn.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 % Test whether stable conditional Gaussian inference works |
wolffd@0 | 2 % Make a linear dynamical system |
wolffd@0 | 3 % X1 -> X2 |
wolffd@0 | 4 % | | |
wolffd@0 | 5 % v v |
wolffd@0 | 6 % Y1 Y2 |
wolffd@0 | 7 |
wolffd@0 | 8 intra = zeros(2); |
wolffd@0 | 9 intra(1,2) = 1; |
wolffd@0 | 10 inter = zeros(2); |
wolffd@0 | 11 inter(1,1) = 1; |
wolffd@0 | 12 n = 2; |
wolffd@0 | 13 |
wolffd@0 | 14 X = 2; % size of hidden state |
wolffd@0 | 15 Y = 2; % size of observable state |
wolffd@0 | 16 |
wolffd@0 | 17 ns = [X Y]; |
wolffd@0 | 18 bnet = mk_dbn(intra, inter, ns, 'discrete', [], 'observed', 2); |
wolffd@0 | 19 |
wolffd@0 | 20 x0 = rand(X,1); |
wolffd@0 | 21 V0 = eye(X); |
wolffd@0 | 22 C0 = rand(Y,X); |
wolffd@0 | 23 R0 = eye(Y); |
wolffd@0 | 24 A0 = rand(X,X); |
wolffd@0 | 25 Q0 = eye(X); |
wolffd@0 | 26 |
wolffd@0 | 27 bnet.CPD{1} = gaussian_CPD(bnet, 1, 'mean', x0, 'cov', V0); |
wolffd@0 | 28 bnet.CPD{2} = gaussian_CPD(bnet, 2, 'mean', zeros(Y,1), 'cov', R0, 'weights', C0); |
wolffd@0 | 29 bnet.CPD{3} = gaussian_CPD(bnet, 3, 'mean', zeros(X,1), 'cov', Q0, 'weights', A0); |
wolffd@0 | 30 |
wolffd@0 | 31 |
wolffd@0 | 32 T = 5; % fixed length sequences |
wolffd@0 | 33 |
wolffd@0 | 34 engine = {}; |
wolffd@0 | 35 engine{end+1} = kalman_inf_engine(bnet); |
wolffd@0 | 36 engine{end+1} = scg_unrolled_dbn_inf_engine(bnet, T); |
wolffd@0 | 37 engine{end+1} = jtree_unrolled_dbn_inf_engine(bnet, T); |
wolffd@0 | 38 |
wolffd@0 | 39 inf_time = cmp_inference_dbn(bnet, engine, T, 'check_ll', 0); |