wolffd@0: function T = convert_to_table(CPD, domain, evidence) wolffd@0: % CONVERT_TO_TABLE Convert a discrete CPD to a table wolffd@0: % T = convert_to_table(CPD, domain, evidence) wolffd@0: % wolffd@0: % We convert the CPD to a CPT, and then lookup the evidence on the discrete parents. wolffd@0: % The resulting table can easily be converted to a potential. wolffd@0: wolffd@0: CPT = CPD_to_CPT(CPD); wolffd@0: odom = domain(~isemptycell(evidence(domain))); wolffd@0: vals = cat(1, evidence{odom}); wolffd@0: map = find_equiv_posns(odom, domain); wolffd@0: index = mk_multi_index(length(domain), map, vals); wolffd@0: T = CPT(index{:});