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. |