comparison toolboxes/FullBNT-1.0.7/bnt/CPDs/@discrete_CPD/convert_CPD_to_table_hidden_ps.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_CPD_to_table_hidden_ps(CPD, child_obs)
2 % CONVERT_CPD_TO_TABLE_HIDDEN_PS Convert a discrete CPD to a table
3 % T = convert_CPD_to_table_hidden_ps(CPD, child_obs)
4 %
5 % This is like convert_to_table, except that we are guaranteed that
6 % none of the parents have evidence on them.
7 % child_obs may be an integer (1,2,...) or [].
8
9 CPT = CPD_to_CPT(CPD);
10 if isempty(child_obs)
11 T = CPT(:);
12 else
13 sz = dom_sizes(CPD);
14 if length(sz)==1 % no parents
15 T = CPT(child_obs);
16 else
17 CPT = reshape(CPT, prod(sz(1:end-1)), sz(end));
18 T = CPT(:, child_obs);
19 end
20 end