Mercurial > hg > camir-aes2014
diff toolboxes/FullBNT-1.0.7/bnt/potentials/check_for_cd_arcs.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/toolboxes/FullBNT-1.0.7/bnt/potentials/check_for_cd_arcs.m Tue Feb 10 15:05:51 2015 +0000 @@ -0,0 +1,23 @@ +function check_for_cd_arcs(onodes, cnodes, dag) +% CHECK_FOR_CD_ARCS Raise an error if there are any C->D links where the C node is hidden. +% check_for_cd_arcs(onodes, cnodes, dag) +% +% We cannot convert the logistic/softmax function (C->D CPD) to a Gaussian potential +% unless we use the variational approximation discussed in +% "A variational approximation for Bayesian networks with discrete and continuous latent +% variables", K. Murphy, UAI 1999. + +n = length(dag); +hnodes = mysetdiff(1:n, onodes); +chid = myintersect(cnodes, hnodes); +dnodes = mysetdiff(1:n, cnodes); +for i=chid(:)' + dcs = myintersect(children(dag, i), dnodes); + if ~isempty(dcs) + error(['hidden cts node ' num2str(i) ' has a discrete child']); + end +end + + + +