To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / _FullBNT / BNT / general / determine_elim_constraints.m @ 8:b5b38998ef3b
History | View | Annotate | Download (1.82 KB)
| 1 |
function partial_order = determine_elim_constraints(bnet, onodes) |
|---|---|
| 2 |
% DETERMINE_ELIM_CONSTRAINTS Determine what the constraints are (if any) on the elimination ordering. |
| 3 |
% partial_order = determine_elim_constraints(bnet, onodes) |
| 4 |
% |
| 5 |
% A graph with different kinds of nodes (e.g., discrete and cts, or decision and rnd) is called marked. |
| 6 |
% A strong root is guaranteed to exist if the marked graph is triangulated and does not have any paths of |
| 7 |
% the form discrete -> cts -> discrete. In general we need to add extra edges to |
| 8 |
% the moral graph to ensure this (see example in Lauritzen (1992) fig 3b). |
| 9 |
% However, a simpler sufficient condition is to eliminate all the cts nodes before the discrete ones, |
| 10 |
% because then, as we move from the leaves to the root, the cts nodes get marginalized away |
| 11 |
% and we are left with purely discrete cliques. |
| 12 |
% |
| 13 |
% partial_order(i,j)=1 if we must marginalize j *before* i |
| 14 |
% (so i will be nearer the strong root). |
| 15 |
% If the hidden nodes are either all discrete or all cts, we set partial_order = []. |
| 16 |
% |
| 17 |
% For details, see |
| 18 |
% - Jensen, Jensen and Dittmer, "From influence diagrams to junction trees", UAI 94. |
| 19 |
% - Lauritzen, "Propgation of probabilities, means, and variances in mixed graphical |
| 20 |
% association models", JASA 87(420):1098--1108, 1992. |
| 21 |
% - K. Olesen, "Causal probabilistic networks with both discrete and continuous variables", |
| 22 |
% IEEE Pami 15(3), 1993 |
| 23 |
|
| 24 |
|
| 25 |
n = length(bnet.dag); |
| 26 |
pot_type = determine_pot_type(bnet, onodes); |
| 27 |
if (pot_type == 'd') | (pot_type == 'g') |
| 28 |
partial_order = []; |
| 29 |
return; |
| 30 |
end |
| 31 |
|
| 32 |
|
| 33 |
partial_order = sparse(n,n); |
| 34 |
partial_order(bnet.dnodes, bnet.cnodes) = 1; |
| 35 |
|
| 36 |
% Integrate out cts nodes before their discrete parents - see Olesen (1993) p9 |
| 37 |
% This method gives the wrong results on cg1.m! |
| 38 |
if 0 |
| 39 |
for i=bnet.cnodes(:)' |
| 40 |
dps = myintersect(parents(bnet.dag, i), bnet.dnodes); |
| 41 |
partial_order(dps, i)=1; |
| 42 |
end |
| 43 |
end |