@Override public double getNodeScore(OENode node) { // accuracy as baseline double score = node.getAccuracy(); // being better than the parent gives a bonus; if(!node.isRoot()) { double accuracyGain = node.getAccuracy() - node.getParent().getAccuracy(); score += accuracyGain * gainBonusFactor; // the root node also gets a bonus to possibly spawn useful disjunctions } else { score += startNodeBonus; } // penalty for horizontal expansion score -= node.getHorizontalExpansion() * expansionPenaltyFactor; // penalty for having many child nodes (stuck prevention) score -= node.getRefinementCount() * nodeRefinementPenalty; return score; }
@Override public double getNodeScore(OENode node) { double score = node.getAccuracy(); double accuracyGain = node.getAccuracy() - node.getParent().getAccuracy(); score += accuracyGain * gainBonusFactor;
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 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(); }
double scoreThreshold = heuristic.getNodeScore(node) + 1 - node.getAccuracy();
double scoreThreshold = heuristic.getNodeScore(node) + 1 - node.getAccuracy();