public void testOutputToDot () throws IOException { FactorGraph mdl = TestInference.createRandomGrid (3, 4, 2, new Random (4234)); PrintWriter out = new PrintWriter (new FileWriter (new File ("grmm-model.dot"))); mdl.printAsDot (out); out.close (); System.out.println ("Now you can open up grmm-model.dot in Graphviz."); }
public void testOutputToDot () throws IOException { FactorGraph mdl = TestInference.createRandomGrid (3, 4, 2, new Random (4234)); PrintWriter out = new PrintWriter (new FileWriter (new File ("grmm-model.dot"))); mdl.printAsDot (out); out.close (); System.out.println ("Now you can open up grmm-model.dot in Graphviz."); }
public static List createTestModels() { Random r = new Random(42); // These models are all small so that we can run the brute force // inferencer on them. FactorGraph[] mdls = new FactorGraph[]{ createTriangle(), createChainGraph(), createRandomGraph(3, 2, r), createRandomGraph(3, 3, r), createRandomGraph(6, 3, r), createRandomGraph(8, 2, r), createRandomGrid(3, 2, 4, r), createRandomGrid(4, 3, 2, r), }; return new ArrayList(Arrays.asList(mdls)); }
public static List createTestModels() { Random r = new Random(42); // These models are all small so that we can run the brute force // inferencer on them. FactorGraph[] mdls = new FactorGraph[]{ createTriangle(), createChainGraph(), createRandomGraph(3, 2, r), createRandomGraph(3, 3, r), createRandomGraph(6, 3, r), createRandomGraph(8, 2, r), createRandomGrid(3, 2, 4, r), createRandomGrid(4, 3, 2, r), }; return new ArrayList(Arrays.asList(mdls)); }
private void createTestTrees() { Random r = new Random(185); trees = new FactorGraph[] { RandomGraphs.createUniformChain (2), RandomGraphs.createUniformChain (4), createJtChain(), createRandomGrid(5, 1, 3, r), createRandomGrid(6, 1, 2, r), createRandomTree(10, 2, r), createRandomTree(10, 2, r), createRandomTree(8, 3, r), createRandomTree(8, 3, r), }; modelsList.addAll(Arrays.asList(trees)); }
public void testLoopyConvergence () { Random r = new Random (67); FactorGraph mdl = createRandomGrid (5, 5, 2, r); LoopyBP loopy = new LoopyBP (); loopy.computeMarginals (mdl); assertTrue (loopy.iterationsUsed() > 8); }
private void createTestTrees() { Random r = new Random(185); trees = new FactorGraph[] { RandomGraphs.createUniformChain (2), RandomGraphs.createUniformChain (4), createJtChain(), createRandomGrid(5, 1, 3, r), createRandomGrid(6, 1, 2, r), createRandomTree(10, 2, r), createRandomTree(10, 2, r), createRandomTree(8, 3, r), createRandomTree(8, 3, r), }; modelsList.addAll(Arrays.asList(trees)); }
public void testLoopyConvergence () { Random r = new Random (67); FactorGraph mdl = createRandomGrid (5, 5, 2, r); LoopyBP loopy = new LoopyBP (); loopy.computeMarginals (mdl); assertTrue (loopy.iterationsUsed() > 8); }