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