annotate toolboxes/FullBNT-1.0.7/bnt/general/dsep.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 sep = dsep(X, Y, S, G)
Daniel@0 2 % DSEP Is X indep Y given S wrt DAG G?
Daniel@0 3 % sep = dsep(X, Y, S, G)
Daniel@0 4 %
Daniel@0 5 % Instead of using the Bayes-Ball criterion, we see if S separates X and Y
Daniel@0 6 % in the moralized ancestral graph.
Daniel@0 7
Daniel@0 8 conn = reachability_graph(G);
Daniel@0 9 M = myunion(myunion(X, Y), S);
Daniel@0 10 [A,junk] = find(conn(:, M));
Daniel@0 11 A = unique(A);
Daniel@0 12 A = myunion(A, M);
Daniel@0 13 GM = moralize(G(A,A));
Daniel@0 14 %sep = graph_separated(GM, X, Y, S);
Daniel@0 15 sep = graph_separated(GM, find_equiv_posns(X,A), find_equiv_posns(Y,A), find_equiv_posns(S,A));