/** Constructs a new FCI search for the given independence test and background knowledge. */ public Rfci(IndependenceTest independenceTest) { if (independenceTest == null || knowledge == null) { throw new NullPointerException(); } this.independenceTest = independenceTest; this.variables.addAll(independenceTest.getVariables()); }
/** * Constructs a new FCI search for the given independence test and background knowledge and a list * of variables to search over. */ public Rfci(IndependenceTest independenceTest, List<Node> searchVars) { if (independenceTest == null || knowledge == null) { throw new NullPointerException(); } this.independenceTest = independenceTest; this.variables.addAll(independenceTest.getVariables()); Set<Node> remVars = new HashSet<Node>(); for (Node node1 : this.variables) { boolean search = false; for (Node node2 : searchVars) { if (node1.getName().equals(node2.getName())) { search = true; } } if (!search) { remVars.add(node1); } } this.variables.removeAll(remVars); }
/** * Runs PC starting with a complete graph over all nodes of the given conditional independence * test, using the given independence test and knowledge and returns the resultant graph. The * returned graph will be a pattern if the independence information is consistent with the * hypothesis that there are no latent common causes. It may, however, contain cycles or * bidirected edges if this assumption is not born out, either due to the actual presence of * latent common causes, or due to statistical errors in conditional independence judgments. */ public Graph search() { return search(independenceTest.getVariables()); }