@Test public void testSearch() { 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); SearchInstances si = new SearchInstances(graph, 1000, 25, 1, ia); for(Node<String> node : graph.nodes()) System.out.println(node + " " + c(node, ia, instances) + ia.classEntropy(node, 1)); System.out.println(si.instance((DNode<String>)c)); }
public double classEntropy(Node<String>node, int depth) { double entropy = 0.0; for(int cls : classes.tokens()) { double p = pClass(cls, node, depth); entropy += p == 0.0 ? 0.0 : p * log2(p); } return - entropy; }
InformedAvoidance implements Scorer { public double classEntropy(Node<String>node, int depth) { double entropy = 0.0; for(int cls : classes.tokens()) { double p = pClass(cls, node, depth); entropy += p == 0.0 ? 0.0 : p * log2(p); } return - entropy; } }
InformedAvoidance implements Scorer { public double classEntropy(Node<String>node, int depth) { double entropy = 0.0; for(int cls : classes.tokens()) { double p = pClass(cls, node, depth); entropy += p == 0.0 ? 0.0 : p * log2(p); } return - entropy; } InformedAvoidance(
			DTGraph<String, String> graph,
			Classified<? extends Node<String>> instances, 
			int maxDepth); }
InformedAvoidance implements Scorer { public double classEntropy(Node<String>node, int depth) { double entropy = 0.0; for(int cls : classes.tokens()) { double p = pClass(cls, node, depth); entropy += p == 0.0 ? 0.0 : p * log2(p); } return - entropy; } 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 classEntropy(Node<String>node, int depth) { double entropy = 0.0; for(int cls : classes.tokens()) { double p = pClass(cls, node, depth); entropy += p == 0.0 ? 0.0 : p * log2(p); } return - entropy; } 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);  }