matthiasm@8: function check_for_cd_arcs(onodes, cnodes, dag) matthiasm@8: % CHECK_FOR_CD_ARCS Raise an error if there are any C->D links where the C node is hidden. matthiasm@8: % check_for_cd_arcs(onodes, cnodes, dag) matthiasm@8: % matthiasm@8: % We cannot convert the logistic/softmax function (C->D CPD) to a Gaussian potential matthiasm@8: % unless we use the variational approximation discussed in matthiasm@8: % "A variational approximation for Bayesian networks with discrete and continuous latent matthiasm@8: % variables", K. Murphy, UAI 1999. matthiasm@8: matthiasm@8: n = length(dag); matthiasm@8: hnodes = mysetdiff(1:n, onodes); matthiasm@8: chid = myintersect(cnodes, hnodes); matthiasm@8: dnodes = mysetdiff(1:n, cnodes); matthiasm@8: for i=chid(:)' matthiasm@8: dcs = myintersect(children(dag, i), dnodes); matthiasm@8: if ~isempty(dcs) matthiasm@8: error(['hidden cts node ' num2str(i) ' has a discrete child']); matthiasm@8: end matthiasm@8: end matthiasm@8: matthiasm@8: matthiasm@8: matthiasm@8: