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