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