@Override public OWLClassExpression getExpression() { return getDescription(); }
@Override public int compare(OENode node1, OENode node2) { return ComparisonChain.start() .compare(getNodeScore(node1), getNodeScore(node2)) .compare(node1.getDescription(), node2.getDescription()) .result(); }
private OENode getNextNodeToExpand() { // we expand the best node of those, which have not achieved 100% accuracy // already and have a horizontal expansion equal to their length // (rationale: further extension is likely to add irrelevant syntactical constructs) synchronized (searchTree) { Iterator<OENode> it = searchTree.descendingIterator(); while(it.hasNext()) { OENode node = it.next(); if (currentlyProcessedNodes.contains(node)) continue; if (isExpandAccuracy100Nodes() && node.getHorizontalExpansion() < OWLClassExpressionUtils.getLength(node.getDescription())) { currentlyProcessedNodes.add(node); return node; } else { if(node.getAccuracy() < 1.0 || node.getHorizontalExpansion() < OWLClassExpressionUtils.getLength(node.getDescription())) { currentlyProcessedNodes.add(node); return node; } } } } // this should practically never be called, since for any reasonable learning // task, we will always have at least one node with less than 100% accuracy return null;//nodes.last(); }
private OENode getNextNodeToExpand() { // we expand the best node of those, which have not achieved 100% accuracy // already and have a horizontal expansion equal to their length // (rationale: further extension is likely to add irrelevant syntactical constructs) Iterator<OENode> it = searchTree.descendingIterator(); if (logger.isTraceEnabled()) { for (OENode N:searchTree.getNodeSet()) { logger.trace(sparql_debug,"`getnext:"+N); } } while(it.hasNext()) { OENode node = it.next(); logger.trace(sparql_debug,"``"+node+node.getAccuracy()); if (isExpandAccuracy100Nodes() && node.getHorizontalExpansion() < OWLClassExpressionUtils.getLength(node.getDescription())) { return node; } else { if(node.getAccuracy() < 1.0 || node.getHorizontalExpansion() < OWLClassExpressionUtils.getLength(node.getDescription())) { return node; } } } // this should practically never be called, since for any reasonable learning // task, we will always have at least one node with less than 100% accuracy throw new RuntimeException("CELOE could not find any node with lesser accuracy."); }
private TreeSet<OWLClassExpression> refineNode(OENode node) { logger.trace(sparql_debug,"REFINE NODE " + node); MonitorFactory.getTimeMonitor("refineNode").start(); // we have to remove and add the node since its heuristic evaluation changes through the expansion // (you *must not* include any criteria in the heuristic which are modified outside of this method, // otherwise you may see rarely occurring but critical false ordering in the nodes set) searchTree.updatePrepare(node); int horizExp = node.getHorizontalExpansion(); TreeSet<OWLClassExpression> refinements = (TreeSet<OWLClassExpression>) operator.refine(node.getDescription(), horizExp+1); // System.out.println("refinements: " + refinements); node.incHorizontalExpansion(); node.setRefinementCount(refinements.size()); // System.out.println("refined node: " + node); searchTree.updateDone(node); MonitorFactory.getTimeMonitor("refineNode").stop(); return refinements; }
(ConceptTransformation.getForallOccurences(description) > ConceptTransformation.getForallOccurences(parentNode.getDescription()))) { SortedSet<PropertyContext> parentContexts = ConceptTransformation.getForallContexts(parentNode.getDescription()); contexts.removeAll(parentContexts);
(ConceptTransformation.getForallOccurences(description) > ConceptTransformation.getForallOccurences(parentNode.getDescription()))) { SortedSet<PropertyContext> parentContexts = ConceptTransformation.getForallContexts(parentNode.getDescription()); contexts.removeAll(parentContexts);
private TreeSet<OWLClassExpression> refineNode(LengthLimitedRefinementOperator operator, OENode node) { MonitorFactory.getTimeMonitor("refineNode").start(); // we have to remove and add the node since its heuristic evaluation changes through the expansion // (you *must not* include any criteria in the heuristic which are modified outside of this method, // otherwise you may see rarely occurring but critical false ordering in the nodes set) searchTree.updatePrepare(node); int horizExp = node.getHorizontalExpansion(); TreeSet<OWLClassExpression> refinements = (TreeSet<OWLClassExpression>) operator.refine(node.getDescription(), horizExp+1); // System.out.println("refinements: " + refinements); node.incHorizontalExpansion(); node.setRefinementCount(refinements.size()); // System.out.println("refined node: " + node); searchTree.updateDone(node); MonitorFactory.getTimeMonitor("refineNode").stop(); return refinements; }