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 / compute_interface_nodes.m @ 8:b5b38998ef3b
History | View | Annotate | Download (1.36 KB)
| 1 |
function [interface, persist, transient] = compute_interface_nodes(intra, inter) |
|---|---|
| 2 |
% COMPUTE_INTERFACE_NODES Find the nodes in a DBN that represent a sufficient statistic |
| 3 |
% [interface, persist, transient] = compute_interface_nodes(intra, inter) |
| 4 |
% |
| 5 |
% The interface nodes are all those that has an incoming temporal arc, |
| 6 |
% or which are parents of such nodes. |
| 7 |
% If the parents are in the previous slice, this just means they have an |
| 8 |
% outgoing temporal arc. |
| 9 |
% (The parents of nodes with incoming temporal arcs are needed |
| 10 |
% because moralization will bring them into the clique.) |
| 11 |
% |
| 12 |
% The persisent nodes are all those that have one or more incoming temporal arc. |
| 13 |
% The transient nodes are all the non-persistent. |
| 14 |
% |
| 15 |
% See U. Kjaerulff, "dHugin: A computational system for dynamic |
| 16 |
% time-sliced Bayesian networks", Intl. J. Forecasting (11) 89-111, 1995 |
| 17 |
|
| 18 |
n = length(intra); |
| 19 |
interface = []; |
| 20 |
persist = []; |
| 21 |
% any nodes with incoming arcs |
| 22 |
for u=1:n |
| 23 |
if any(inter(:,u)) |
| 24 |
interface = [interface u]; |
| 25 |
persist = [persist u]; |
| 26 |
end |
| 27 |
end |
| 28 |
% Any nodes which are parents of nodes with incoming arcs |
| 29 |
for u=1:n |
| 30 |
cs = children(intra, u); |
| 31 |
if any(inter(:, cs)) |
| 32 |
interface = [interface u]; |
| 33 |
end |
| 34 |
%cs = children(inter, u); |
| 35 |
% if ~isempty(myintersect(cs, persist)) |
| 36 |
% interface = [interface u]; |
| 37 |
%end |
| 38 |
end |
| 39 |
interface = unique(interface); |
| 40 |
persist = unique(persist); |
| 41 |
transient = mysetdiff(1:n, persist); |
| 42 |
|