Mercurial > hg > camir-aes2014
comparison toolboxes/FullBNT-1.0.7/bnt/CPDs/@discrete_CPD/convert_to_table.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 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 domain = domain(:); | |
9 CPT = CPD_to_CPT(CPD); | |
10 odom = domain(~isemptycell(evidence(domain))); | |
11 vals = cat(1, evidence{odom}); | |
12 map = find_equiv_posns(odom, domain); | |
13 index = mk_multi_index(length(domain), map, vals); | |
14 T = CPT(index{:}); | |
15 T = T(:); |