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 / bayesian_score_CPD.m @ 8:b5b38998ef3b
History | View | Annotate | Download (386 Bytes)
| 1 |
function score = bayesian_score_CPD(CPD, local_ev) |
|---|---|
| 2 |
% bayesian_score_CPD Compute the Bayesian score of a tabular CPD using uniform Dirichlet prior |
| 3 |
% score = bayesian_score_CPD(CPD, local_ev) |
| 4 |
% |
| 5 |
% The Bayesian score is the log marginal likelihood |
| 6 |
|
| 7 |
if iscell(local_ev) |
| 8 |
data = num2cell(local_ev); |
| 9 |
else |
| 10 |
data = local_ev; |
| 11 |
end |
| 12 |
|
| 13 |
score = dirichlet_score_family(compute_counts(data, CPD.sizes)); |