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