Daniel@0: Daniel@0:

Example of more complex parameter tieing

Daniel@0: Daniel@0: We now give a more complex pattern of parameter tieing. Daniel@0: (This example is due to Rainer Deventer.) Daniel@0: The structure is as follows: Daniel@0:

Daniel@0: Daniel@0: Daniel@0:

Daniel@0: Since nodes 2 and 3 in slice 2 (N7 and N8) Daniel@0: have different parents than their counterparts in slice 1 (N2 and N3), Daniel@0: they must be put into different equivalence classes. Daniel@0: Hence we define Daniel@0:

Daniel@0: eclass1 = [1 2 3 4 5];
Daniel@0: eclass2 = [1 6 7 4 5];
Daniel@0: 
Daniel@0: The dotted bubbles represent the equivalence classes. Daniel@0: Node 7 is the representative node for equivalence class Daniel@0: 6, and node 8 is the rep. for class 7, so we need to write Daniel@0:
Daniel@0: bnet.CPD{6} = xxx_CPD(bnet, 7, xxx);
Daniel@0: bnet.CPD{7} = xxx_CPD(bnet, 8, xxx);
Daniel@0: 
Daniel@0: In general, you can use the following code fragment: Daniel@0:
Daniel@0: eclass = bnet.equiv_class(:);
Daniel@0: for e=1:max(eclass)
Daniel@0:   i = bnet.rep_of_eclass(e);
Daniel@0:   bnet.CPD{e} = xxx_CPD(bnet,i);
Daniel@0: end
Daniel@0: 
Daniel@0: