To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / _FullBNT / BNT / CPDs / @tabular_CPD / Old / prob_CPT.m @ 8:b5b38998ef3b
History | View | Annotate | Download (410 Bytes)
| 1 |
function p = prob_CPT(CPD, x) |
|---|---|
| 2 |
% PROB_CPT Lookup the prob. of a family value in a tabular CPD |
| 3 |
% p = prob_CPT(CPD, x) |
| 4 |
% |
| 5 |
% This is a version of prob_CPD optimized for tables. |
| 6 |
|
| 7 |
switch length(x) |
| 8 |
case 1, p = CPD.CPT(x); |
| 9 |
case 2, p = CPD.CPT(x(1), x(2)); |
| 10 |
case 3, p = CPD.CPT(x(1), x(2), x(3)); |
| 11 |
case 4, p = CPD.CPT(x(1), x(2), x(3), x(4)); |
| 12 |
otherwise, |
| 13 |
ind = subv2ind(mysize(CPD.CPT), x); |
| 14 |
p = CPD.CPT(ind); |
| 15 |
end |
| 16 |
|