From: <ku...@us...> - 2008-08-22 15:52:25
|
Revision: 1128 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1128&view=rev Author: kurzum Date: 2008-08-22 15:52:22 +0000 (Fri, 22 Aug 2008) Log Message: ----------- output is showing accuracy now Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-08-22 13:15:50 UTC (rev 1127) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-08-22 15:52:22 UTC (rev 1128) @@ -399,8 +399,10 @@ // we record when a more accurate node is found and log it if (bestNodeStable.getCovPosMinusCovNeg() < candidatesStable.last() .getCovPosMinusCovNeg()) { - String acc = (candidatesStable.last().getAccuracy(nrOfPositiveExamples, nrOfNegativeExamples)+"").substring(2,6); - acc= acc.substring(0,2)+"."+acc.substring(3)+"%"; + String acc = (candidatesStable.last().getAccuracy(nrOfPositiveExamples, nrOfNegativeExamples))+""; + try { acc = acc.substring(2,6); + acc= acc.substring(0,2)+"."+acc.substring(3)+"%";}catch (Exception e) { } + // no handling needed, it will just look ugly in the output logger.info("more accurate ("+acc+") node found: " + candidatesStable.last()); bestNodeStable = candidatesStable.last(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-09-16 22:30:34
|
Revision: 1222 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1222&view=rev Author: jenslehmann Date: 2008-09-17 05:30:32 +0000 (Wed, 17 Sep 2008) Log Message: ----------- small fix Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-09-16 18:17:33 UTC (rev 1221) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-09-17 05:30:32 UTC (rev 1222) @@ -848,7 +848,7 @@ // it is often useful to continue expanding until a longer node is // reached (to replace atomic concepts with more specific ones) - if(forceRefinementLengthIncrease) { + if(forceRefinementLengthIncrease && !newNode.isTooWeak()) { // extend node again if its concept has the same length if(node.getConcept().getLength() == newNode.getConcept().getLength()) { extendNodeProper(newNode, refinement, maxLength, recDepth + 1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2009-02-12 17:34:58
|
Revision: 1598 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1598&view=rev Author: kurzum Date: 2009-02-12 17:34:55 +0000 (Thu, 12 Feb 2009) Log Message: ----------- flagged functions as deprecated, which should be removed. new function isTerminationCriteriaReached introduced. which should be the only function that cares for stopping solutionFound: see comment where I marked deprecated it Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2009-02-12 16:50:12 UTC (rev 1597) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2009-02-12 17:34:55 UTC (rev 1598) @@ -107,11 +107,11 @@ // extended Options private long maxExecutionTimeInSeconds; - private boolean maxExecutionTimeShown = false; + private boolean maxExecutionTimeAlreadyReached = false; private long minExecutionTimeInSeconds = 0; - private boolean minExecutionTimeShown = false; + private boolean minExecutionTimeAlreadyReached = false; private int guaranteeXgoodDescriptions = 1; - private boolean guaranteeXgoodShown = false; + private boolean guaranteeXgoodAlreadyReached = false; private int maxClassDescriptionTests; // if set to false we do not test properness; this may seem wrong @@ -149,6 +149,8 @@ private ExampleBasedNode startNode; // solution protocol + // TODO isn't solution found already true if solutions.size()>=0 ??? + @Deprecated private boolean solutionFound = false; private List<Description> solutions = new LinkedList<Description>(); @@ -300,9 +302,9 @@ newCandidates.clear(); solutionFound = false; solutions.clear(); - maxExecutionTimeShown = false; - minExecutionTimeShown = false; - guaranteeXgoodShown = false; + maxExecutionTimeAlreadyReached = false; + minExecutionTimeAlreadyReached = false; + guaranteeXgoodAlreadyReached = false; propernessTestsReasoner = 0; propernessTestsAvoidedByShortConceptConstruction = 0; propernessTestsAvoidedByTooWeakList = 0; @@ -407,7 +409,8 @@ long reductionInterval = 300l * 1000000000l; long currentTime; - while ((!solutionFound || !configurator.getTerminateOnNoiseReached() ) && !stop) { + while (!isTerminationCriteriaReached()) { + //while ((!solutionFound || !configurator.getTerminateOnNoiseReached() ) && !stop) { // print statistics at most once a second currentTime = System.nanoTime(); @@ -515,7 +518,8 @@ loop++; }// end while - if (solutionFound) { + if (isSolutionFound()) { + //if (solutionFound) { int solutionLimit = 20; // we do not need to print the best node if we display the top 20 solutions below anyway // logger.info("best node " @@ -1351,6 +1355,100 @@ return true; } + + + /** + * In this function it is calculated if the algorithm should stop. + * This is not always depends whether an actual solution was found + * The algorithm stops if: + * 1. the object attribute stop is set to true (possibly by an outside source) + * 2. the maximimum execution time is reached + * 3. the maximum number of class description tests is reached + * + * Continuation criteria and result improvement + * The algorithm continues (although it would normally stop) if + * 1. Minimum execution time is not reached (default 0) + * 2. not enough good solutions are found (default 1) + * otherwise it stops + * + * @return true if the algorithm should stop, this is mostly indepent of the question if a solution was found + */ + private boolean isTerminationCriteriaReached(){ + if(this.stop){ + return true; + } + long totalTimeNeeded = System.currentTimeMillis() - this.runtime; + long maxMilliSeconds = maxExecutionTimeInSeconds * 1000; + long minMilliSeconds = minExecutionTimeInSeconds * 1000; + int conceptTests = conceptTestsReasoner + conceptTestsTooWeakList + conceptTestsOverlyGeneralList; + boolean result = false; + + //ignore default + if (maxExecutionTimeInSeconds == 0) + result = false; + //alreadyReached + else if (maxExecutionTimeAlreadyReached) + return true; + //test + else if (maxMilliSeconds < totalTimeNeeded) { + this.stop(); + logger.info("Maximum time (" + maxExecutionTimeInSeconds + + " seconds) reached, stopping now..."); + maxExecutionTimeAlreadyReached = true; + return true; + } + + //ignore default + if(maxClassDescriptionTests == 0) + result = false; + //test + else if(conceptTests >= maxClassDescriptionTests){ + logger.info("Maximum Class Description tests (" + maxClassDescriptionTests + + " tests [actual: "+conceptTests+"]) reached, stopping now..."); + return true; + } + + + if (guaranteeXgoodAlreadyReached){ + result = true; + } else if(solutions.size() >= guaranteeXgoodDescriptions) { + logger.info("Minimum number (" + guaranteeXgoodDescriptions + + ") of good descriptions reached."); + guaranteeXgoodAlreadyReached = true; + result = true; + } + + + if (minExecutionTimeAlreadyReached){ + result = result && true; + }else if(minMilliSeconds < totalTimeNeeded) { + logger.info("Minimum time (" + minExecutionTimeInSeconds + + " seconds) reached."); + minExecutionTimeAlreadyReached = true; + result = result && true; + } + + return result; + + } + + /** + * shows if a solution is found + * @return + */ + private boolean isSolutionFound(){ + if(this.solutionFound){ + return true; + }else if(solutions.size()>0){ + return true; + } + + return false; + + + } + + @Deprecated private void handleStoppingConditions() { solutionFound = (guaranteeXgoodDescriptions()); solutionFound = (minExecutionTimeReached() && solutionFound); @@ -1365,32 +1463,34 @@ } } + @Deprecated private boolean guaranteeXgoodDescriptions() { - if (guaranteeXgoodShown) + if (guaranteeXgoodAlreadyReached) return true; if (solutions.size() > guaranteeXgoodDescriptions) { if (guaranteeXgoodDescriptions != 1) { logger.info("Minimum number (" + guaranteeXgoodDescriptions + ") of good descriptions reached, stopping now."); } - guaranteeXgoodShown = true; + guaranteeXgoodAlreadyReached = true; return true; } else return false; } + @Deprecated private boolean maxExecutionTimeReached() { if (maxExecutionTimeInSeconds == 0) return false; - if (maxExecutionTimeShown) + if (maxExecutionTimeAlreadyReached) return true; long needed = System.currentTimeMillis() - this.runtime; long maxMilliSeconds = maxExecutionTimeInSeconds * 1000; if (maxMilliSeconds < needed) { logger.info("Maximum time (" + maxExecutionTimeInSeconds + " seconds) reached, stopping now..."); - maxExecutionTimeShown = true; + maxExecutionTimeAlreadyReached = true; return true; } else return false; @@ -1402,8 +1502,9 @@ * * @return true */ + @Deprecated private boolean minExecutionTimeReached() { - if (minExecutionTimeShown) + if (minExecutionTimeAlreadyReached) return true; long needed = System.currentTimeMillis() - this.runtime; long minMilliSeconds = minExecutionTimeInSeconds * 1000; @@ -1412,7 +1513,7 @@ logger.info("Minimum time (" + minExecutionTimeInSeconds + " seconds) reached, stopping when next solution is found"); } - minExecutionTimeShown = true; + minExecutionTimeAlreadyReached = true; return true; } else return false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |