annotate toolboxes/FullBNT-1.0.7/bnt/CPDs/@tabular_CPD/Old/prob_CPT.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function p = prob_CPT(CPD, x)
wolffd@0 2 % PROB_CPT Lookup the prob. of a family value in a tabular CPD
wolffd@0 3 % p = prob_CPT(CPD, x)
wolffd@0 4 %
wolffd@0 5 % This is a version of prob_CPD optimized for tables.
wolffd@0 6
wolffd@0 7 switch length(x)
wolffd@0 8 case 1, p = CPD.CPT(x);
wolffd@0 9 case 2, p = CPD.CPT(x(1), x(2));
wolffd@0 10 case 3, p = CPD.CPT(x(1), x(2), x(3));
wolffd@0 11 case 4, p = CPD.CPT(x(1), x(2), x(3), x(4));
wolffd@0 12 otherwise,
wolffd@0 13 ind = subv2ind(mysize(CPD.CPT), x);
wolffd@0 14 p = CPD.CPT(ind);
wolffd@0 15 end
wolffd@0 16