From: <jen...@us...> - 2007-09-01 01:34:45
|
Revision: 86 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=86&view=rev Author: jenslehmann Date: 2007-08-28 06:24:54 -0700 (Tue, 28 Aug 2007) Log Message: ----------- intermediate commit for statistics generation script Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/utilities/PaperStatistics.java Modified: trunk/src/dl-learner/org/dllearner/utilities/PaperStatistics.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/PaperStatistics.java 2007-08-28 13:23:47 UTC (rev 85) +++ trunk/src/dl-learner/org/dllearner/utilities/PaperStatistics.java 2007-08-28 13:24:54 UTC (rev 86) @@ -23,6 +23,7 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.SortedSet; import java.util.TreeSet; @@ -61,6 +62,54 @@ @SuppressWarnings("unused") private static void createStatistics() { + // experimental setup: + + // algorithms: refinement, GP, hybrid GP (YinYang) + // settings GP: + // - average over 10 runs + // ... + // settings Hybrid GP: + // - average over 10 runs + // ... + // settings refinement: + // - single run + // ... + + // observations: + // - correctness + // - concept length + // - runtime + + // learning examples: + // - trains + // - arches + // - moral (simple) + // - moral (complex) + // - poker (pair) + // - poker (straight) + // - uncle (FORTE) + // - more? + + String exampleBaseDir = "examples/"; + + File[] confFiles = new File[1]; + confFiles[0] = new File(exampleBaseDir, "trains/trains.conf"); + + /* + Stat[][] statAr = new Stat[4][3]; + File[][] fileAr = new File[4][3]; + + fileAr[0][0] = new File(baseDir, "gnuplot/hybrid100classification.data"); + fileAr[0][1] = new File(baseDir, "gnuplot/hybrid100length.data"); + fileAr[0][2] = new File(baseDir, "gnuplot/hybrid100runtime.data"); + fileAr[1][0] = new File(baseDir, "gnuplot/hybrid50classification.data"); + fileAr[1][1] = new File(baseDir, "gnuplot/hybrid50length.data"); + fileAr[1][2] = new File(baseDir, "gnuplot/hybrid50runtime.data"); + fileAr[2][0] = new File(baseDir, "gnuplot/gpclassification.data"); + fileAr[2][1] = new File(baseDir, "gnuplot/gplength.data"); + fileAr[2][2] = new File(baseDir, "gnuplot/gpruntime.data"); + */ + // set reasoner URL try { Config.digReasonerURL = new URL("http://localhost:8081"); @@ -68,21 +117,17 @@ e.printStackTrace(); } - // used OWL files - File fatherOwlFile = new File("examples/father.owl"); String fatherConfFile = "examples/father2.conf"; - URL ontologyFatherURL = null; - try { - ontologyFatherURL = new URL("file", "localhost", fatherOwlFile.getAbsolutePath()); - } catch (MalformedURLException e1) { - e1.printStackTrace(); - } - Map<URL, OntologyFileFormat> m = new HashMap<URL, OntologyFileFormat>(); - m.put(ontologyFatherURL, OntologyFileFormat.RDF_XML); + // file is parsed, but we use only the specified examples really + // (everything else is ignored) + DLLearner.parseFile(fatherConfFile); + // DLLearner.parseFile(fatherConfFile); + Map<URL, OntologyFileFormat> imports = getImports(DLLearner.getFunctionCalls()); + // initialise reasoner - Reasoner reasoner = Main.createReasoner(new KB(), m); + Reasoner reasoner = Main.createReasoner(new KB(), imports); ReasoningService rs = new ReasoningService(reasoner); Main.autoDetectConceptsAndRoles(rs); @@ -96,10 +141,6 @@ } } - // file is parsed, but we use only the specified examples really - // (everything else is ignored) - DLLearner.parseFile(fatherConfFile); - SortedSet<Individual> positiveExamples = new TreeSet<Individual>(); SortedSet<Individual> negativeExamples = new TreeSet<Individual>(); Map<AtomicConcept,SortedSet<Individual>> posExamplesTmp = DLLearner.getPositiveExamples(); @@ -110,6 +151,8 @@ for (AtomicConcept target : negExamplesTmp.keySet()) negativeExamples = negExamplesTmp.get(target); + + LearningProblem learningProblem = new LearningProblem(rs, positiveExamples, negativeExamples); ROLearner learner = new ROLearner(learningProblem); @@ -118,4 +161,46 @@ } + private static Map<URL, OntologyFileFormat> getImports(List<List<String>> functionCalls) { + Map<URL, OntologyFileFormat> importedFiles = new HashMap<URL, OntologyFileFormat>(); + + OntologyFileFormat format = null; + URL url = null; + + for (List<String> call : functionCalls) { + + if(call.get(0).equals("import")) { + // alte Methode mit file statt URI + // File f = new File(baseDir, call.get(1)); + + try { + String fileString = call.get(1); + if(fileString.startsWith("http:")) { + url = new URL(fileString); + } else { + File f = new File("examples", call.get(1)); + url = f.toURI().toURL(); + } + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + if (call.size() == 2) + // falls nichts angegeben, dann wird RDF/XML gewählt + importedFiles.put(url, OntologyFileFormat.RDF_XML); + else { + String formatString = call.get(2); + if (formatString.equals("RDF/XML")) + format = OntologyFileFormat.RDF_XML; + else + format = OntologyFileFormat.N_TRIPLES; + importedFiles.put(url, format); + } + } + } + + return importedFiles; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |