From: <jen...@us...> - 2011-04-07 08:51:32
|
Revision: 2761 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2761&view=rev Author: jenslehmann Date: 2011-04-07 08:51:26 +0000 (Thu, 07 Apr 2011) Log Message: ----------- bug fix Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java 2011-04-06 11:51:54 UTC (rev 2760) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java 2011-04-07 08:51:26 UTC (rev 2761) @@ -200,8 +200,8 @@ // compute used concepts/roles from allowed/ignored // concepts/roles Set<NamedClass> usedConcepts; - Set<NamedClass> allowedConcepts = CommonConfigMappings.getAtomicConceptSet(configurator.getAllowedConcepts()); - Set<NamedClass> ignoredConcepts = CommonConfigMappings.getAtomicConceptSet(configurator.getIgnoredConcepts()); + Set<NamedClass> allowedConcepts = configurator.getAllowedConcepts()==null ? null : CommonConfigMappings.getAtomicConceptSet(configurator.getAllowedConcepts()); + Set<NamedClass> ignoredConcepts = configurator.getIgnoredConcepts()==null ? null : CommonConfigMappings.getAtomicConceptSet(configurator.getIgnoredConcepts()); if(allowedConcepts != null) { // sanity check to control if no non-existing concepts are in the list Helper.checkConcepts(reasoner, allowedConcepts); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2012-01-05 14:12:57
|
Revision: 3528 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3528&view=rev Author: jenslehmann Date: 2012-01-05 14:12:51 +0000 (Thu, 05 Jan 2012) Log Message: ----------- refined termination criteria for CELOE Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java 2012-01-05 13:54:07 UTC (rev 3527) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java 2012-01-05 14:12:51 UTC (rev 3528) @@ -172,17 +172,26 @@ @ConfigOption(name = "reuseExistingDescription", defaultValue="false", description="If true, the algorithm tries to find a good starting point close to an existing definition/super class of the given class in the knowledge base.") private boolean reuseExistingDescription = false; - @ConfigOption(name = "maxClassDescriptionTests", defaultValue="0", description="The maximum number of candidate hypothesis the algorithm is allowed to test (0 = no limit). The algorithm will stop afterwards. (The real number of tests can be slightly higher, because this criterion usually won't be checked after each single test.)") - private int maxClassDescriptionTests = 0; + @ConfigOption(name = "maxClassExpressionTests", defaultValue="0", description="The maximum number of candidate hypothesis the algorithm is allowed to test (0 = no limit). The algorithm will stop afterwards. (The real number of tests can be slightly higher, because this criterion usually won't be checked after each single test.)") + private int maxClassExpressionTests = 0; - @ConfigOption(defaultValue = "10", name = "maxExecutionTimeInSeconds", description = "maximum execution of the algorithm in seconds") - private int maxExecutionTimeInSeconds = 10; + @ConfigOption(name = "maxClassExpressionTestsAfterImprovement", defaultValue="0", description = "The maximum number of candidate hypothesis the algorithm is allowed after an improvement in accuracy (0 = no limit). The algorithm will stop afterwards. (The real number of tests can be slightly higher, because this criterion usually won't be checked after each single test.)") + private int maxClassExpressionTestsAfterImprovement = 0; + + @ConfigOption(defaultValue = "0", name = "maxExecutionTimeInSeconds", description = "maximum execution of the algorithm in seconds") + private int maxExecutionTimeInSeconds = 0; + @ConfigOption(defaultValue = "10", name = "maxExecutionTimeInSecondsAfterImprovement", description = "maximum execution of the algorithm in seconds") + private int maxExecutionTimeInSecondsAfterImprovement = 10; + @ConfigOption(name = "terminateOnNoiseReached", defaultValue="false", description="specifies whether to terminate when noise criterion is met") private boolean terminateOnNoiseReached = false; @ConfigOption(name = "maxDepth", defaultValue="7", description="maximum depth of description") private double maxDepth = 7; + + private int expressionTestCountLastImprovement; + private long timeLastImprovement = 0; // public CELOEConfigurator getConfigurator() { // return configurator; @@ -427,7 +436,9 @@ if(!singleSuggestionMode && bestEvaluatedDescriptions.getBestAccuracy() > highestAccuracy) { highestAccuracy = bestEvaluatedDescriptions.getBestAccuracy(); - logger.info("more accurate (" + dfPercent.format(highestAccuracy) + ") class expression found: " + descriptionToString(bestEvaluatedDescriptions.getBest().getDescription())); + expressionTestCountLastImprovement = expressionTests; + timeLastImprovement = System.nanoTime(); + logger.info("more accurate (" + dfPercent.format(highestAccuracy) + ") class expression found: " + descriptionToString(bestEvaluatedDescriptions.getBest().getDescription())); } // chose best node according to heuristics @@ -765,7 +776,9 @@ private boolean terminationCriteriaSatisfied() { return stop || - (maxClassDescriptionTests != 0 && (expressionTests >= maxClassDescriptionTests)) || + (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)); } @@ -954,11 +967,11 @@ } public int getMaxClassDescriptionTests() { - return maxClassDescriptionTests; + return maxClassExpressionTests; } public void setMaxClassDescriptionTests(int maxClassDescriptionTests) { - this.maxClassDescriptionTests = maxClassDescriptionTests; + this.maxClassExpressionTests = maxClassDescriptionTests; } public int getMaxExecutionTimeInSeconds() { @@ -999,6 +1012,24 @@ public void setHeuristic(OEHeuristicRuntime heuristic) { this.heuristic = heuristic; + } + + public int getMaxClassExpressionTestsWithoutImprovement() { + return maxClassExpressionTestsAfterImprovement; + } + + public void setMaxClassExpressionTestsWithoutImprovement( + int maxClassExpressionTestsWithoutImprovement) { + this.maxClassExpressionTestsAfterImprovement = maxClassExpressionTestsWithoutImprovement; + } + + public int getMaxExecutionTimeInSecondsAfterImprovement() { + return maxExecutionTimeInSecondsAfterImprovement; + } + + public void setMaxExecutionTimeInSecondsAfterImprovement( + int maxExecutionTimeInSecondsAfterImprovement) { + this.maxExecutionTimeInSecondsAfterImprovement = maxExecutionTimeInSecondsAfterImprovement; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2012-02-06 15:28:02
|
Revision: 3571 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3571&view=rev Author: lorenz_b Date: 2012-02-06 15:27:51 +0000 (Mon, 06 Feb 2012) Log Message: ----------- Added missing getter and setter methods, needed for usage of ConfigHelper. Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java 2012-02-06 14:15:12 UTC (rev 3570) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java 2012-02-06 15:27:51 UTC (rev 3571) @@ -32,6 +32,7 @@ import org.apache.log4j.Logger; import org.dllearner.core.AbstractCELA; +import org.dllearner.core.AbstractKnowledgeSource; import org.dllearner.core.AbstractLearningProblem; import org.dllearner.core.AbstractReasonerComponent; import org.dllearner.core.ComponentAnn; @@ -45,10 +46,12 @@ import org.dllearner.core.owl.NamedClass; import org.dllearner.core.owl.Restriction; import org.dllearner.core.owl.Thing; +import org.dllearner.kb.OWLFile; import org.dllearner.learningproblems.ClassLearningProblem; import org.dllearner.learningproblems.PosNegLP; import org.dllearner.learningproblems.PosNegLPStandard; import org.dllearner.learningproblems.PosOnlyLP; +import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.refinementoperators.OperatorInverter; import org.dllearner.refinementoperators.RefinementOperator; import org.dllearner.refinementoperators.RhoDRDown; @@ -1037,4 +1040,56 @@ this.maxExecutionTimeInSecondsAfterImprovement = maxExecutionTimeInSecondsAfterImprovement; } + public boolean isSingleSuggestionMode() { + return singleSuggestionMode; + } + + public void setSingleSuggestionMode(boolean singleSuggestionMode) { + this.singleSuggestionMode = singleSuggestionMode; + } + + public int getMaxClassExpressionTests() { + return maxClassExpressionTests; + } + + public void setMaxClassExpressionTests(int maxClassExpressionTests) { + this.maxClassExpressionTests = maxClassExpressionTests; + } + + public int getMaxClassExpressionTestsAfterImprovement() { + return maxClassExpressionTestsAfterImprovement; + } + + public void setMaxClassExpressionTestsAfterImprovement( + int maxClassExpressionTestsAfterImprovement) { + this.maxClassExpressionTestsAfterImprovement = maxClassExpressionTestsAfterImprovement; + } + + public double getMaxDepth() { + return maxDepth; + } + + public void setMaxDepth(double maxDepth) { + this.maxDepth = maxDepth; + } + + public static void main(String[] args) throws Exception{ + AbstractKnowledgeSource ks = new OWLFile("../examples/family/father_oe.owl"); + ks.init(); + + AbstractReasonerComponent rc = new FastInstanceChecker(ks); + rc.init(); + + ClassLearningProblem lp = new ClassLearningProblem(rc); + lp.setClassToDescribe(new NamedClass("http://example.com/father#father")); + lp.init(); + + CELOE alg = new CELOE(lp, rc); + alg.setMaxExecutionTimeInSeconds(10); + alg.init(); + + alg.start(); + + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tc...@us...> - 2012-05-22 00:31:12
|
Revision: 3723 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3723&view=rev Author: tcanvn Date: 2012-05-22 00:31:06 +0000 (Tue, 22 May 2012) Log Message: ----------- Add "stopOnFirstDefinition" option for CELOE algorithm. If this is set to true, the algorithm will stop when the first definition is found Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java 2012-05-18 11:10:14 UTC (rev 3722) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java 2012-05-22 00:31:06 UTC (rev 3723) @@ -21,7 +21,6 @@ import java.io.File; import java.text.DecimalFormat; -import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; import java.util.List; @@ -193,7 +192,13 @@ @ConfigOption(name = "maxDepth", defaultValue="7", description="maximum depth of description") private double maxDepth = 7; + @ConfigOption(name = "stopOnFirstDefinition", defaultValue="false", description="algorithm will terminate immediately when a correct definition is found") + private boolean stopOnFirstDefinition = false; + private int expressionTestCountLastImprovement; + + + @SuppressWarnings("unused") private long timeLastImprovement = 0; // public CELOEConfigurator getConfigurator() { @@ -787,7 +792,8 @@ (maxClassExpressionTests != 0 && (expressionTests >= maxClassExpressionTests)) || (maxExecutionTimeInSecondsAfterImprovement != 0 && ((System.nanoTime() - nanoStartTime) >= (maxExecutionTimeInSecondsAfterImprovement*1000000000l))) || (maxExecutionTimeInSeconds != 0 && ((System.nanoTime() - nanoStartTime) >= (maxExecutionTimeInSeconds*1000000000l))) || - (terminateOnNoiseReached && (100*getCurrentlyBestAccuracy()>=100-noisePercentage)); + (terminateOnNoiseReached && (100*getCurrentlyBestAccuracy()>=100-noisePercentage)) || + (stopOnFirstDefinition && (getCurrentlyBestAccuracy() >= 1)); } private void reset() { @@ -1072,7 +1078,16 @@ public void setMaxDepth(double maxDepth) { this.maxDepth = maxDepth; } + + + public boolean isStopOnFirstDefinition() { + return stopOnFirstDefinition; + } + public void setStopOnFirstDefinition(boolean stopOnFirstDefinition) { + this.stopOnFirstDefinition = stopOnFirstDefinition; + } + public static void main(String[] args) throws Exception{ AbstractKnowledgeSource ks = new OWLFile("../examples/family/father_oe.owl"); ks.init(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |