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