annotate toolboxes/FullBNT-1.0.7/docs/param_tieing.html @ 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
wolffd@0 2 <h2>Example of more complex parameter tieing</h2>
wolffd@0 3
wolffd@0 4 We now give a more complex pattern of parameter tieing.
wolffd@0 5 (This example is due to Rainer Deventer.)
wolffd@0 6 The structure is as follows:
wolffd@0 7 <p>
wolffd@0 8 <img src="Figures/rainer_tied.gif" height="400">
wolffd@0 9 <!--<img src="rainer_dbn.jpg" height="600">-->
wolffd@0 10 <p>
wolffd@0 11 Since nodes 2 and 3 in slice 2 (N7 and N8)
wolffd@0 12 have different parents than their counterparts in slice 1 (N2 and N3),
wolffd@0 13 they must be put into different equivalence classes.
wolffd@0 14 Hence we define
wolffd@0 15 <pre>
wolffd@0 16 eclass1 = [1 2 3 4 5];
wolffd@0 17 eclass2 = [1 6 7 4 5];
wolffd@0 18 </pre>
wolffd@0 19 The dotted bubbles represent the equivalence classes.
wolffd@0 20 Node 7 is the representative node for equivalence class
wolffd@0 21 6, and node 8 is the rep. for class 7, so we need to write
wolffd@0 22 <pre>
wolffd@0 23 bnet.CPD{6} = xxx_CPD(bnet, 7, xxx);
wolffd@0 24 bnet.CPD{7} = xxx_CPD(bnet, 8, xxx);
wolffd@0 25 </pre>
wolffd@0 26 In general, you can use the following code fragment:
wolffd@0 27 <pre>
wolffd@0 28 eclass = bnet.equiv_class(:);
wolffd@0 29 for e=1:max(eclass)
wolffd@0 30 i = bnet.rep_of_eclass(e);
wolffd@0 31 bnet.CPD{e} = xxx_CPD(bnet,i);
wolffd@0 32 end
wolffd@0 33 </pre>
wolffd@0 34 <!--
wolffd@0 35 which is equivalent to
wolffd@0 36 <pre>
wolffd@0 37 E = max(eclass);
wolffd@0 38 rep = zeros(1,E);
wolffd@0 39 for e=1:E
wolffd@0 40 mems = find(eclass==e);
wolffd@0 41 rep(e) = mems(1);
wolffd@0 42 end
wolffd@0 43 for e=1:E
wolffd@0 44 bnet.CPD{e} = xxx_CPD(bnet, rep(e));
wolffd@0 45 end
wolffd@0 46 </pre>
wolffd@0 47 -->