Search in sources :

Example 1 with IndependenceFacts

use of edu.cmu.tetrad.data.IndependenceFacts in project tetrad by cmu-phil.

the class TestIndependenceFacts method test1.

@Test
public void test1() {
    IndependenceFactsModel facts = new IndependenceFactsModel();
    Node x1 = new GraphNode("X1");
    Node x2 = new GraphNode("X2");
    Node x3 = new GraphNode("X3");
    Node x4 = new GraphNode("X4");
    Node x5 = new GraphNode("X5");
    Node x6 = new GraphNode("X6");
    facts.add(new IndependenceFact(x1, x2, x3));
    facts.add(new IndependenceFact(x2, x3));
    facts.add(new IndependenceFact(x2, x4, x1, x2));
    facts.add(new IndependenceFact(x2, x4, x1, x3, x5));
    facts.add(new IndependenceFact(x2, x4, x3));
    facts.add(new IndependenceFact(x2, x4, x3, x6));
    facts.remove(new IndependenceFact(x1, x2, x3));
    IndependenceFacts _facts = new IndependenceFacts(facts.getFacts());
    assertTrue(_facts.isIndependent(x4, x2, x1, x2));
    assertTrue(_facts.isIndependent(x4, x2, x5, x3, x1));
    List<Node> l = new ArrayList<>();
    l.add(x1);
    l.add(x2);
    assertTrue(_facts.isIndependent(x4, x2, l));
}
Also used : IndependenceFacts(edu.cmu.tetrad.data.IndependenceFacts) IndependenceFactsModel(edu.cmu.tetradapp.model.IndependenceFactsModel) GraphNode(edu.cmu.tetrad.graph.GraphNode) Node(edu.cmu.tetrad.graph.Node) ArrayList(java.util.ArrayList) GraphNode(edu.cmu.tetrad.graph.GraphNode) IndependenceFact(edu.cmu.tetrad.graph.IndependenceFact) Test(org.junit.Test)

Aggregations

IndependenceFacts (edu.cmu.tetrad.data.IndependenceFacts)1 GraphNode (edu.cmu.tetrad.graph.GraphNode)1 IndependenceFact (edu.cmu.tetrad.graph.IndependenceFact)1 Node (edu.cmu.tetrad.graph.Node)1 IndependenceFactsModel (edu.cmu.tetradapp.model.IndependenceFactsModel)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1