@Override public Object clone() throws CloneNotSupportedException { return new PCELOE(this); }
private void showIfBetterSolutionsFound() { if(!singleSuggestionMode && bestEvaluatedDescriptions.getBestAccuracy() > currentHighestAccuracy) { currentHighestAccuracy = bestEvaluatedDescriptions.getBestAccuracy(); expressionTestCountLastImprovement = expressionTests; timeLastImprovement = System.nanoTime(); long durationInMillis = getCurrentRuntimeInMilliSeconds(); String durationStr = getDurationAsString(durationInMillis); logger.info("more accurate (" + dfPercent.format(currentHighestAccuracy) + ") class expression found after " + durationStr + ": " + descriptionToString(bestEvaluatedDescriptions.getBest().getDescription())); } }
public PCELOE(PCELOE celoe){ setReasoner(celoe.reasoner); setLearningProblem(celoe.learningProblem); setAllowedConcepts(celoe.getAllowedConcepts()); setAllowedObjectProperties(celoe.getAllowedObjectProperties()); setAllowedDataProperties(celoe.getAllowedDataProperties()); setIgnoredConcepts(celoe.ignoredConcepts); setIgnoredObjectProperties(celoe.getIgnoredObjectProperties()); setIgnoredDataProperties(celoe.getIgnoredDataProperties()); setExpandAccuracy100Nodes(celoe.expandAccuracy100Nodes); setFilterDescriptionsFollowingFromKB(celoe.filterDescriptionsFollowingFromKB); setHeuristic(celoe.heuristic); setMaxClassExpressionTests(celoe.maxClassExpressionTests); setMaxClassExpressionTestsAfterImprovement(celoe.maxClassExpressionTestsAfterImprovement); setMaxDepth(celoe.maxDepth); setMaxExecutionTimeInSeconds(celoe.maxExecutionTimeInSeconds); setMaxExecutionTimeInSecondsAfterImprovement(celoe.maxExecutionTimeInSecondsAfterImprovement); setMaxNrOfResults(celoe.maxNrOfResults); setNoisePercentage(celoe.noisePercentage); setOperator(op); setReuseExistingDescription(celoe.reuseExistingDescription); setSingleSuggestionMode(celoe.singleSuggestionMode); setStartClass(celoe.startClass); setStopOnFirstDefinition(celoe.stopOnFirstDefinition);
public static void main(String[] args) throws Exception{ // StringRenderer.setRenderer(Rendering.DL_SYNTAX); Logger.getRootLogger().setLevel(Level.INFO); Logger.getLogger(PCELOE.class).setLevel(Level.DEBUG); Logger.getLogger(PCELOE.class).addAppender(new FileAppender(new PatternLayout( "[%t] %c: %m%n" ), "log/parallel_run.txt", false)); AbstractKnowledgeSource ks = new OWLFile("../examples/family/father_oe.owl"); ks.init(); AbstractReasonerComponent rc = new ClosedWorldReasoner(ks); rc.init(); ClassLearningProblem lp = new ClassLearningProblem(rc); lp.setClassToDescribe(new OWLClassImpl(IRI.create("http://example.com/father#father"))); lp.setCheckConsistency(false); lp.init(); PCELOE alg = new PCELOE(lp, rc); alg.setMaxExecutionTimeInSeconds(10); alg.setNrOfThreads(4); // alg.setMaxClassDescriptionTests(200); alg.init(); alg.start(); }
ClassHierarchy classHierarchy = initClassHierarchy(); ObjectPropertyHierarchy objectPropertyHierarchy = initObjectPropertyHierarchy(); DatatypePropertyHierarchy datatypePropertyHierarchy = initDataPropertyHierarchy(); startClass = computeStartClass(); } else { try {
reset(); nanoStartTime = System.nanoTime(); addNode(startClass, null); logger.info("solutions:\n" + getSolutionString());
if(!isDescriptionAllowed(description, parentNode)) { return false; bestAccuracy = accuracy; bestDescription = description; logger.info("more accurate (" + dfPercent.format(bestAccuracy) + ") class expression found: " + descriptionToString(bestDescription)); // + getTemporaryString(bestDescription)); if(!isDescriptionAllowed(niceDescription, node)) { return false;
private boolean terminationCriteriaSatisfied() { return stop || (maxClassExpressionTestsAfterImprovement != 0 && (expressionTests - expressionTestCountLastImprovement >= maxClassExpressionTestsAfterImprovement)) || (maxClassExpressionTests != 0 && (expressionTests >= maxClassExpressionTests)) || (maxExecutionTimeInSecondsAfterImprovement != 0 && ((System.nanoTime() - nanoStartTime) >= (maxExecutionTimeInSecondsAfterImprovement* 1000000000L))) || (maxExecutionTimeInSeconds != 0 && ((System.nanoTime() - nanoStartTime) >= (maxExecutionTimeInSeconds* 1000000000L))) || (terminateOnNoiseReached && (100*getCurrentlyBestAccuracy()>=100-noisePercentage)) || (stopOnFirstDefinition && (getCurrentlyBestAccuracy() >= 1)); }
@Override public OWLClassExpression getCurrentlyBestDescription() { EvaluatedDescription<? extends Score> ed = getCurrentlyBestEvaluatedDescription(); return ed == null ? null : ed.getDescription(); }