From: <jen...@us...> - 2007-08-31 14:52:09
|
Revision: 123 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=123&view=rev Author: jenslehmann Date: 2007-08-31 07:25:18 -0700 (Fri, 31 Aug 2007) Log Message: ----------- added method for counting axioms small improvements in statistics script Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/dl/KB.java trunk/src/dl-learner/org/dllearner/utilities/PaperStatistics.java Modified: trunk/src/dl-learner/org/dllearner/dl/KB.java =================================================================== --- trunk/src/dl-learner/org/dllearner/dl/KB.java 2007-08-31 14:21:57 UTC (rev 122) +++ trunk/src/dl-learner/org/dllearner/dl/KB.java 2007-08-31 14:25:18 UTC (rev 123) @@ -201,4 +201,9 @@ return connectedSet; } + + public int getNumberOfAxioms() { + return (abox.size() + tbox.size() + rbox.size()); + } + } Modified: trunk/src/dl-learner/org/dllearner/utilities/PaperStatistics.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/PaperStatistics.java 2007-08-31 14:21:57 UTC (rev 122) +++ trunk/src/dl-learner/org/dllearner/utilities/PaperStatistics.java 2007-08-31 14:25:18 UTC (rev 123) @@ -116,6 +116,7 @@ examples[4] = "poker (49 examples, pair)"; examples[5] = "poker (55 examples, straight)"; examples[6] = "uncle (FORTE data set)"; + int startExampleNr = 0; String[] algorithms = new String[3]; algorithms[0] = "refinement"; @@ -123,6 +124,9 @@ algorithms[2] = "hybrid"; int[] algorithmRuns = {1,10,10}; + int startAlgorithmNr = 0; + + // do not plot anything // File[][][] gnuplotFiles = new File[examples.length][algorithms.length][3]; @@ -143,7 +147,7 @@ ConfigurationManager confMgr = new ConfigurationManager(); confMgr.applyOptions(); - for(int exampleNr=0; exampleNr < examples.length; exampleNr++) { + for(int exampleNr=startExampleNr; exampleNr < examples.length; exampleNr++) { // parse current conf file DLLearner.parseFile(confFiles[exampleNr].toString()); @@ -164,7 +168,7 @@ statString += "example: " + examples[exampleNr] + "\n\n"; - for(int algorithmNr=0; algorithmNr < algorithms.length; algorithmNr++) { + for(int algorithmNr=startAlgorithmNr; algorithmNr < algorithms.length; algorithmNr++) { Stat classification = new Stat(); Stat length = new Stat(); @@ -178,6 +182,13 @@ Reasoner reasoner = Main.createReasoner(new KB(), imports); ReasoningService rs = new ReasoningService(reasoner); + // System.out.println(positiveExamples); + // System.out.println(negativeExamples); + // System.exit(0); + + // create learning problem + LearningProblem learningProblem = new LearningProblem(rs, positiveExamples, negativeExamples); + // prepare reasoner for using subsumption and role hierarchy // TODO: currently, it is a small unfairness that each algorithm // uses the same reasoning object (e.g. the second algorithm may @@ -194,10 +205,7 @@ } catch (ReasoningMethodUnsupportedException e) { e.printStackTrace(); } - - // create learning problem - LearningProblem learningProblem = new LearningProblem(rs, positiveExamples, negativeExamples); - + LearningAlgorithm learningAlgorithm = null; if(algorithmNr==0) { Config.algorithm = Algorithm.REFINEMENT; @@ -213,6 +221,8 @@ Config.GP.generations = 50; Config.GP.useFixedNumberOfGenerations = true; Config.GP.numberOfIndividuals = 201; + // if(exampleNr == 3 || exampleNr == 4) + // Config.GP.numberOfIndividuals = 51; Config.GP.refinementProbability = 0; Config.GP.mutationProbability = 0.02; Config.GP.crossoverProbability = 0.8; @@ -226,6 +236,8 @@ Config.GP.generations = 50; Config.GP.useFixedNumberOfGenerations = true; Config.GP.numberOfIndividuals = 201; + //if(exampleNr == 3 || exampleNr == 4) + // Config.GP.numberOfIndividuals = 51; Config.GP.refinementProbability = 0.65; Config.GP.mutationProbability = 0.02; Config.GP.crossoverProbability = 0.2; @@ -234,7 +246,8 @@ learningAlgorithm = new GP(learningProblem); } - rs.resetStatistics(); + // rs.resetStatistics(); + long algorithmStartTime = System.nanoTime(); learningAlgorithm.start(); long algorithmTime = System.nanoTime() - algorithmStartTime; @@ -256,7 +269,7 @@ statDetailsString += "example: " + examples[exampleNr] + "\n"; statDetailsString += "algorithm: " + algorithms[algorithmNr] + "\n"; statDetailsString += "learned concept: " + learningAlgorithm.getBestSolution() + "\n"; - statDetailsString += "classification: " + classificationRatePercent + "\n"; + statDetailsString += "classification: " + classificationRatePercent + "%\n"; statDetailsString += "concept length: " + conceptLength + "\n"; statDetailsString += "runtime: " + Helper.prettyPrintNanoSeconds(algorithmTime) + "\n\n"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |