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