comparison toolboxes/FullBNT-1.0.7/bnt/CPDs/@discrete_CPD/CPD_to_scgpot.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 function pot = CPD_to_scgpot(CPD, domain, ns, cnodes, evidence)
2 % CPD_TO_SCGPOT Convert a CPD to a CG potential, incorporating any evidence (discrete)
3 % pot = CPD_to_scgpot(CPD, domain, ns, cnodes, evidence)
4 %
5 % domain is the domain of CPD.
6 % node_sizes(i) is the size of node i.
7 % cnodes
8 % evidence{i} is the evidence on the i'th node.
9
10 %odom = domain(~isemptycell(evidence(domain)));
11
12 %vals = cat(1, evidence{odom});
13 %map = find_equiv_posns(odom, domain);
14 %index = mk_multi_index(length(domain), map, vals);
15 CPT = CPD_to_CPT(CPD);
16 %CPT = CPT(index{:});
17 CPT = CPT(:);
18 %ns(odom) = 1;
19 potarray = cell(1, length(CPT));
20 for i=1:length(CPT)
21 %p = CPT(i);
22 potarray{i} = scgcpot(0, 0, CPT(i));
23 %scpot{i} = scpot(0, 0);
24 end
25 pot = scgpot(domain, [], [], ns, potarray);