Mercurial > hg > camir-ismir2012
annotate toolboxes/FullBNT-1.0.7/bnt/potentials/check_for_cd_arcs.m @ 0:cc4b1211e677 tip
initial commit to HG from
Changeset:
646 (e263d8a21543) added further path and more save "camirversion.m"
author | Daniel Wolff |
---|---|
date | Fri, 19 Aug 2016 13:07:06 +0200 |
parents | |
children |
rev | line source |
---|---|
Daniel@0 | 1 function check_for_cd_arcs(onodes, cnodes, dag) |
Daniel@0 | 2 % CHECK_FOR_CD_ARCS Raise an error if there are any C->D links where the C node is hidden. |
Daniel@0 | 3 % check_for_cd_arcs(onodes, cnodes, dag) |
Daniel@0 | 4 % |
Daniel@0 | 5 % We cannot convert the logistic/softmax function (C->D CPD) to a Gaussian potential |
Daniel@0 | 6 % unless we use the variational approximation discussed in |
Daniel@0 | 7 % "A variational approximation for Bayesian networks with discrete and continuous latent |
Daniel@0 | 8 % variables", K. Murphy, UAI 1999. |
Daniel@0 | 9 |
Daniel@0 | 10 n = length(dag); |
Daniel@0 | 11 hnodes = mysetdiff(1:n, onodes); |
Daniel@0 | 12 chid = myintersect(cnodes, hnodes); |
Daniel@0 | 13 dnodes = mysetdiff(1:n, cnodes); |
Daniel@0 | 14 for i=chid(:)' |
Daniel@0 | 15 dcs = myintersect(children(dag, i), dnodes); |
Daniel@0 | 16 if ~isempty(dcs) |
Daniel@0 | 17 error(['hidden cts node ' num2str(i) ' has a discrete child']); |
Daniel@0 | 18 end |
Daniel@0 | 19 end |
Daniel@0 | 20 |
Daniel@0 | 21 |
Daniel@0 | 22 |
Daniel@0 | 23 |