From: <jen...@us...> - 2011-08-29 16:48:56
|
Revision: 3163 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3163&view=rev Author: jenslehmann Date: 2011-08-29 16:48:49 +0000 (Mon, 29 Aug 2011) Log Message: ----------- CELOE working with the new configuration system for the first time - hooray Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java trunk/components-core/src/main/java/org/dllearner/learningproblems/PosNegLPStandard.java trunk/components-core/src/main/java/org/dllearner/refinementoperators/RhoDRDown.java trunk/examples/sparql/moosique_new.conf trunk/scripts/src/main/java/org/dllearner/scripts/DocumentationHTMLGenerator.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-08-29 14:24:00 UTC (rev 3162) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java 2011-08-29 16:48:49 UTC (rev 3163) @@ -63,6 +63,7 @@ import org.dllearner.utilities.owl.DescriptionMinimizer; import org.dllearner.utilities.owl.EvaluatedDescriptionSet; import org.dllearner.utilities.owl.PropertyContext; +import org.springframework.beans.factory.annotation.Autowired; import com.jamonapi.Monitor; import com.jamonapi.MonitorFactory; @@ -121,9 +122,9 @@ private long nanoStartTime; - // important parameters + // important parameters (non-config options but internal) private double noise; - private double maxDepth; + private boolean filterFollowsFromKB; // less important parameters @@ -142,33 +143,36 @@ private int minHorizExp = 0; private int maxHorizExp = 0; - ConceptComparator cc = new ConceptComparator(); - // TODO: turn those into config options - Set<NamedClass> allowedConcepts = new TreeSet<NamedClass>(cc); - Set<NamedClass> ignoredConcepts = new TreeSet<NamedClass>(cc); + // important: do not initialise those with empty sets + // null = no settings for allowance / ignorance + // empty set = allow / ignore nothing (it is often not desired to allow no class!) + Set<NamedClass> allowedConcepts = null; + Set<NamedClass> ignoredConcepts = null; - private boolean writeSearchTree; + private boolean writeSearchTree = false; private String searchTreeFile = "log/searchTree.txt"; - private int maxNrOfResults; + private int maxNrOfResults = 10; - private double noisePercentage; + private double noisePercentage = 0.0; - private boolean filterDescriptionsFollowingFromKB; + private boolean filterDescriptionsFollowingFromKB = false; - private boolean reuseExistingDescription; + private boolean reuseExistingDescription = false; - private boolean replaceSearchTree; + private boolean replaceSearchTree = false; - private int maxClassDescriptionTests; + private int maxClassDescriptionTests = 0; - private int maxExecutionTimeInSeconds; + private int maxExecutionTimeInSeconds = 100; - private boolean terminateOnNoiseReached; + private boolean terminateOnNoiseReached = false; + private double maxDepth = 7; + // public CELOEConfigurator getConfigurator() { // return configurator; // } @@ -226,9 +230,7 @@ @Override public void init() throws ComponentInitException { - -// System.out.println("inds: " + reasoner.getIndividuals()); - + // compute used concepts/roles from allowed/ignored // concepts/roles Set<NamedClass> usedConcepts; @@ -249,7 +251,7 @@ // ClassHierarchy classHierarchy = reasoner.getClassHierarchy().clone(); ClassHierarchy classHierarchy = reasoner.getClassHierarchy().cloneAndRestrict(usedConcepts); classHierarchy.thinOutSubsumptionHierarchy(); - + // if no one injected a heuristic, we use a default one if(heuristic == null) { heuristic = new OEHeuristicRuntime(); @@ -266,13 +268,14 @@ operator = new RhoDRDown(); ((RhoDRDown)operator).setStartClass(startClass); ((RhoDRDown)operator).setSubHierarchy(classHierarchy); + ((RhoDRDown)operator).setReasoner(reasoner); + ((RhoDRDown)operator).init(); } // operator = new RhoDRDown(reasoner, classHierarchy, startClass, configurator); baseURI = reasoner.getBaseURI(); prefixes = reasoner.getPrefixes(); if(writeSearchTree) { File f = new File(searchTreeFile ); -// System.out.println(f.getAbsolutePath()); Files.clearFile(f); } @@ -288,6 +291,12 @@ // is not a class learning problem filterFollowsFromKB = filterDescriptionsFollowingFromKB && isClassLearningProblem; +// Set<Description> concepts = operator.refine(Thing.instance, 5); +// for(Description concept : concepts) { +// System.out.println(concept); +// } +// System.out.println("refinements of thing: " + concepts.size()); + // actions specific to ontology engineering if(isClassLearningProblem) { ClassLearningProblem problem = (ClassLearningProblem) learningProblem; @@ -434,12 +443,15 @@ // for(Description refinement : refinements) { // System.out.println("refinement: " + refinement); // } +// if(loop > 10) { +// System.exit(0); +// } while(refinements.size() != 0) { // pick element from set Description refinement = refinements.pollFirst(); int length = refinement.getLength(); - + // we ignore all refinements with lower length and too high depth // (this also avoids duplicate node children) if(length > horizExp && refinement.getDepth() <= maxDepth) { @@ -538,7 +550,7 @@ // returns true if node was added and false otherwise private boolean addNode(Description description, OENode parentNode) { -// System.out.println(description); +// System.out.println("d: " + description); // redundancy check (return if redundant) boolean nonRedundant = descriptions.add(description); @@ -857,6 +869,7 @@ return operator; } + @Autowired(required=false) public void setOperator(RefinementOperator operator) { this.operator = operator; } Modified: trunk/components-core/src/main/java/org/dllearner/learningproblems/PosNegLPStandard.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/learningproblems/PosNegLPStandard.java 2011-08-29 14:24:00 UTC (rev 3162) +++ trunk/components-core/src/main/java/org/dllearner/learningproblems/PosNegLPStandard.java 2011-08-29 16:48:49 UTC (rev 3163) @@ -508,8 +508,8 @@ // maybe use this approach: // int maxNotCovered = (int) Math.ceil(noise*positiveExamples.size()+0.0001); - System.out.println("noise: " + noise); - System.out.println("max not covered: " + maxNotCovered); +// System.out.println("noise: " + noise); +// System.out.println("max not covered: " + maxNotCovered); int notCoveredPos = 0; int notCoveredNeg = 0; @@ -518,7 +518,7 @@ if (!getReasoner().hasType(description, example)) { notCoveredPos++; - System.out.println("d:" + description + "; ex:" + example); +// System.out.println("d:" + description + "; ex:" + example); if(notCoveredPos >= maxNotCovered) { return -1; @@ -531,8 +531,8 @@ } } - System.out.println("not covered pos: " + notCoveredPos); - System.out.println("not covered neg: " + notCoveredNeg); +// System.out.println("not covered pos: " + notCoveredPos); +// System.out.println("not covered neg: " + notCoveredNeg); // if(useFMeasure) { // double recall = (positiveExamples.size() - notCoveredPos) / (double) positiveExamples.size(); Modified: trunk/components-core/src/main/java/org/dllearner/refinementoperators/RhoDRDown.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/refinementoperators/RhoDRDown.java 2011-08-29 14:24:00 UTC (rev 3162) +++ trunk/components-core/src/main/java/org/dllearner/refinementoperators/RhoDRDown.java 2011-08-29 16:48:49 UTC (rev 3163) @@ -279,6 +279,8 @@ // subHierarchy = rs.getClassHierarchy(); public void init() { +// System.out.println("subHierarchy: " + subHierarchy); + // query reasoner for domains and ranges // (because they are used often in the operator) for(ObjectProperty op : reasoner.getObjectProperties()) { Modified: trunk/examples/sparql/moosique_new.conf =================================================================== --- trunk/examples/sparql/moosique_new.conf 2011-08-29 14:24:00 UTC (rev 3162) +++ trunk/examples/sparql/moosique_new.conf 2011-08-29 16:48:49 UTC (rev 3163) @@ -48,8 +48,7 @@ jamendoOntology.fileName = "jamendo.owl" // jamendo.owl" -// reasoner.type = "fast instance checker" -reasoner.type = "OWL API Reasoner" +reasoner.type = "fast instance checker" reasoner.sources = {jamendo, jamendoOntology} // we want to learn from positive examples only Modified: trunk/scripts/src/main/java/org/dllearner/scripts/DocumentationHTMLGenerator.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/DocumentationHTMLGenerator.java 2011-08-29 14:24:00 UTC (rev 3162) +++ trunk/scripts/src/main/java/org/dllearner/scripts/DocumentationHTMLGenerator.java 2011-08-29 16:48:49 UTC (rev 3163) @@ -22,9 +22,10 @@ import java.io.File; import java.util.List; import java.util.Map; +import java.util.TreeMap; import java.util.Map.Entry; -import java.util.TreeMap; +import org.dllearner.algorithms.SimpleSubclassLearner; import org.dllearner.core.AnnComponentManager; import org.dllearner.core.Component; import org.dllearner.core.config.ConfigHelper; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |