annotate toolboxes/FullBNT-1.0.7/bnt/examples/dynamic/orig_water1.m @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
rev   line source
Daniel@0 1 % Compare the speeds of various inference engines on the water DBN
Daniel@0 2 seed = 0;
Daniel@0 3 rand('state', seed);
Daniel@0 4 randn('state', seed);
Daniel@0 5
Daniel@0 6 %bnet = mk_water_dbn;
Daniel@0 7 bnet = mk_orig_water_dbn;
Daniel@0 8
Daniel@0 9 T = 3;
Daniel@0 10 engine = {};
Daniel@0 11 %engine{end+1} = smoother_engine(jtree_2TBN_inf_engine(bnet));
Daniel@0 12 %engine{end+1} = smoother_engine(hmm_2TBN_inf_engine(bnet));
Daniel@0 13 %engine{end+1} = jtree_dbn_inf_engine(bnet);
Daniel@0 14 engine{end+1} = jtree_unrolled_dbn_inf_engine(bnet, T);
Daniel@0 15 engine{end+1} = cbk_inf_engine(bnet, 'clusters', {[1],[2],[3],[4],[5],[6],[7],[8]}); %ff
Daniel@0 16 engine{end+1} = cbk_inf_engine(bnet, 'clusters', {[1 2],[3 4 5 6],[7 8]}); %manually designed marginally independent by BK
Daniel@0 17 engine{end+1} = cbk_inf_engine(bnet, 'clusters', {[1:5], [3:7], [7:8]}); %manually designed conditionally independent by BK
Daniel@0 18 engine{end+1} = cbk_inf_engine(bnet, 'clusters', {[1 3], [2 3 7], [3 5], [3 4 7], [6 7 8]}); %automatically found using TJTs offline
Daniel@0 19 engine{end+1} = cbk_inf_engine(bnet, 'clusters', {[1 3 5], [2 3 5 7], [3 4 7], [4 6 7], [6 7 8]}); %automatically found using TJTs offline
Daniel@0 20 engine{end+1} = cbk_inf_engine(bnet, 'clusters', {[1 3 4 5], [2 3 4 7 8], [4 6 7 8]}); %automatically found using TJTs offline
Daniel@0 21
Daniel@0 22 % bk_inf_engine yields exactly the same results for the marginally independent cases.
Daniel@0 23 %engine{end+1} = bk_inf_engine(bnet, 'clusters', 'ff');
Daniel@0 24 %engine{end+1} = bk_inf_engine(bnet, 'clusters', { [1 2], [3 4 5 6], [7 8] });
Daniel@0 25
Daniel@0 26
Daniel@0 27 inf_time = cmp_inference_dbn(bnet, engine, T, 'exact', 1)
Daniel@0 28 learning_time = cmp_learning_dbn(bnet, engine, T, 'exact', 1)