To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Revision:

root / _FullBNT / BNT / CPDs / @discrete_CPD / CPD_to_scgpot.m @ 8:b5b38998ef3b

History | View | Annotate | Download (791 Bytes)

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);