annotate _FullBNT/BNT/potentials/check_for_cd_arcs.m @ 9:4ea6619cb3f5 tip

removed log files
author matthiasm
date Fri, 11 Apr 2014 15:55:11 +0100
parents b5b38998ef3b
children
rev   line source
matthiasm@8 1 function check_for_cd_arcs(onodes, cnodes, dag)
matthiasm@8 2 % CHECK_FOR_CD_ARCS Raise an error if there are any C->D links where the C node is hidden.
matthiasm@8 3 % check_for_cd_arcs(onodes, cnodes, dag)
matthiasm@8 4 %
matthiasm@8 5 % We cannot convert the logistic/softmax function (C->D CPD) to a Gaussian potential
matthiasm@8 6 % unless we use the variational approximation discussed in
matthiasm@8 7 % "A variational approximation for Bayesian networks with discrete and continuous latent
matthiasm@8 8 % variables", K. Murphy, UAI 1999.
matthiasm@8 9
matthiasm@8 10 n = length(dag);
matthiasm@8 11 hnodes = mysetdiff(1:n, onodes);
matthiasm@8 12 chid = myintersect(cnodes, hnodes);
matthiasm@8 13 dnodes = mysetdiff(1:n, cnodes);
matthiasm@8 14 for i=chid(:)'
matthiasm@8 15 dcs = myintersect(children(dag, i), dnodes);
matthiasm@8 16 if ~isempty(dcs)
matthiasm@8 17 error(['hidden cts node ' num2str(i) ' has a discrete child']);
matthiasm@8 18 end
matthiasm@8 19 end
matthiasm@8 20
matthiasm@8 21
matthiasm@8 22
matthiasm@8 23