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 / @tabular_kernel / convert_to_table.m @ 8:b5b38998ef3b

History | View | Annotate | Download (520 Bytes)

1
function T = convert_to_table(CPD, domain, evidence)
2
% CONVERT_TO_TABLE Convert a discrete CPD to a table
3
% T = convert_to_table(CPD, domain, evidence)
4
%
5
% We convert the CPD to a CPT, and then lookup the evidence on the discrete parents.
6
% The resulting table can easily be converted to a potential.
7

    
8
CPT = CPD.table;
9
odom = domain(~isemptycell(evidence(domain)));
10
vals = cat(1, evidence{odom});
11
map = find_equiv_posns(odom, domain);
12
index = mk_multi_index(length(domain), map, vals);
13
T = CPT(index{:});