wolffd@0: function T = convert_CPD_to_table_hidden_ps(CPD, child_obs) wolffd@0: % CONVERT_CPD_TO_TABLE_HIDDEN_PS Convert a discrete CPD to a table wolffd@0: % T = convert_CPD_to_table_hidden_ps(CPD, child_obs) wolffd@0: % wolffd@0: % This is like convert_to_table, except that we are guaranteed that wolffd@0: % none of the parents have evidence on them. wolffd@0: % child_obs may be an integer (1,2,...) or []. wolffd@0: wolffd@0: CPT = CPD_to_CPT(CPD); wolffd@0: if isempty(child_obs) wolffd@0: T = CPT(:); wolffd@0: else wolffd@0: sz = dom_sizes(CPD); wolffd@0: if length(sz)==1 % no parents wolffd@0: T = CPT(child_obs); wolffd@0: else wolffd@0: CPT = reshape(CPT, prod(sz(1:end-1)), sz(end)); wolffd@0: T = CPT(:, child_obs); wolffd@0: end wolffd@0: end