@Test public void test() { DTGraph<String, String> graph = new MapDTGraph<String, String>(); Node<String> a = graph.add("a"), b = graph.add("b"), c = graph.add("c"), d = graph.add("d"), e = graph.add("e"), f = graph.add("f"), g = graph.add("g"); a.connect(b); b.connect(c); b.connect(f); c.connect(d); c.connect(g); d.connect(e); f.connect(g); Classified<Node<String>> instances = Classification.empty(); instances.add(c, 0); instances.add(f, 0); instances.add(e, 1); InformedAvoidance ia = new InformedAvoidance(graph, instances, 1); assertEquals(2.0/3.0, ia.p(0), 0.0); assertEquals(1.0/3.0, ia.p(1), 0.0); assertEquals(0.0, ia.p(a, 1), 0.0); assertEquals(2.0/3.0, ia.p(b, 1), 0.0); assertEquals(1.0/3.0, ia.p(c, 1), 0.0); assertEquals(2.0/3.0, ia.p(d, 1), 0.0); assertEquals(1.0/3.0, ia.p(e, 1), 0.0); assertEquals(1.0/3.0, ia.p(f, 1), 0.0); assertEquals(2.0/3.0, ia.p(g, 1), 0.0); assertEquals(0.0, ia.p(a, 0, 1), 0.0); assertEquals(2.0/2.0, ia.p(b, 0, 1), 0.0); assertEquals(1.0/2.0, ia.p(c, 0, 1), 0.0); assertEquals(1.0/2.0, ia.p(d, 0, 1), 0.0); assertEquals(0.0 , ia.p(e, 0, 1), 0.0); assertEquals(1.0/2.0, ia.p(f, 0, 1), 0.0); assertEquals(2.0/2.0, ia.p(g, 0, 1), 0.0); assertEquals(0.0, ia.p(a, 1, 1), 0.0); assertEquals(0.0, ia.p(b, 1, 1), 0.0); assertEquals(0.0, ia.p(c, 1, 1), 0.0); assertEquals(1.0, ia.p(d, 1, 1), 0.0); assertEquals(1.0, ia.p(e, 1, 1), 0.0); assertEquals(0.0, ia.p(f, 1, 1), 0.0); assertEquals(0.0, ia.p(g, 1, 1), 0.0); assertEquals(0.0, sum(ia, a, instances), 0.0); assertEquals(2.0/3.0, sum(ia, b, instances), 0.0); assertEquals(1.0/3.0, sum(ia, c, instances), 0.0); assertEquals(2.0/3.0, sum(ia, d, instances), 0.0); assertEquals(1.0/3.0, sum(ia, e, instances), 0.0); assertEquals(1.0/3.0, sum(ia, f, instances), 0.0); assertEquals(2.0/3.0, sum(ia, g, instances), 0.0); }
public double p(Node<String> node, int depth) { if(depth == 0) return 0.0; return counts.get(depth).frequency(node) / (double) instances.size(); }
InformedAvoidance implements Scorer { public double p(Node<String> node, int depth) { if(depth == 0) return 0.0; return counts.get(depth).frequency(node) / (double) instances.size(); } }
InformedAvoidance implements Scorer { public double p(Node<String> node, int depth) { if(depth == 0) return 0.0; return counts.get(depth).frequency(node) / (double) instances.size(); } InformedAvoidance(
			DTGraph<String, String> graph,
			Classified<? extends Node<String>> instances, 
			int maxDepth); }
InformedAvoidance implements Scorer { public double p(Node<String> node, int depth) { if(depth == 0) return 0.0; return counts.get(depth).frequency(node) / (double) instances.size(); } InformedAvoidance(
			DTGraph<String, String> graph,
			Classified<? extends Node<String>> instances, 
			int maxDepth); Comparator<DTNode<String, String>> informedComparator(int depth); Comparator<DTNode<String, String>> uninformedComparator(int depth); boolean viableHub(Node<String> node, int depth, int numInstances); double p(Node<String> node, int depth); double p(Node<String> node, int cls, int depth); double p(int cls); double pClass(int cls, Node<String> node, int depth); double classEntropy(Node<String>node, int depth); @Override double score(Node<String> node, int depth); }
InformedAvoidance implements Scorer { public double p(Node<String> node, int depth) { if(depth == 0) return 0.0; return counts.get(depth).frequency(node) / (double) instances.size(); } InformedAvoidance(
			DTGraph<String, String> graph,
			Classified<? extends Node<String>> instances, 
			int maxDepth); Comparator<DTNode<String, String>> informedComparator(int depth); Comparator<DTNode<String, String>> uninformedComparator(int depth); boolean viableHub(Node<String> node, int depth, int numInstances); double p(Node<String> node, int depth); double p(Node<String> node, int cls, int depth); double p(int cls); double pClass(int cls, Node<String> node, int depth); double classEntropy(Node<String>node, int depth); @Override double score(Node<String> node, int depth);  }