annotate toolboxes/FullBNT-1.0.7/bnt/general/compute_interface_nodes.m @ 0:e9a9cd732c1e tip

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