Mercurial > hg > camir-aes2014
annotate toolboxes/FullBNT-1.0.7/bnt/CPDs/@root_CPD/convert_to_pot.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 = convert_to_pot(CPD, pot_type, domain, evidence) |
wolffd@0 | 2 % CONVERT_TO_POT Convert a root CPD to one or more potentials |
wolffd@0 | 3 % pots = convert_to_pot(CPD, pot_type, domain, evidence) |
wolffd@0 | 4 |
wolffd@0 | 5 assert(length(domain)==1); |
wolffd@0 | 6 assert(~isempty(evidence(domain))); |
wolffd@0 | 7 T = 1; |
wolffd@0 | 8 |
wolffd@0 | 9 sz = CPD.sizes; |
wolffd@0 | 10 ns = zeros(1, max(domain)); |
wolffd@0 | 11 ns(domain) = sz; |
wolffd@0 | 12 |
wolffd@0 | 13 switch pot_type |
wolffd@0 | 14 case 'u', |
wolffd@0 | 15 pot = upot(domain, 1, T, 0); |
wolffd@0 | 16 case 'd', |
wolffd@0 | 17 ns(domain) = 1; |
wolffd@0 | 18 pot = dpot(domain, ns(domain), T); |
wolffd@0 | 19 case {'c','g'}, |
wolffd@0 | 20 ns(domain) = 0; |
wolffd@0 | 21 pot = cpot(domain, ns(domain), 0); |
wolffd@0 | 22 case 'cg', |
wolffd@0 | 23 ddom = []; |
wolffd@0 | 24 cdom = domain; % we assume the root node is cts |
wolffd@0 | 25 %pot = cgpot(ddom, cdom, ns, {cpot([],[],0)}); |
wolffd@0 | 26 pot = cgpot(ddom, cdom, ns); |
wolffd@0 | 27 end |
wolffd@0 | 28 |