From: <jen...@us...> - 2011-04-06 07:07:27
|
Revision: 2758 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2758&view=rev Author: jenslehmann Date: 2011-04-06 07:07:20 +0000 (Wed, 06 Apr 2011) Log Message: ----------- added option to allow/ignore classes in CELOE Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java trunk/components-core/src/main/java/org/dllearner/core/configurators/CELOEConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/ISLEConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/OCELConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/PosNegLPStandardConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/PosNegLPStrictConfigurator.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-04-05 17:03:24 UTC (rev 2757) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java 2011-04-06 07:07:20 UTC (rev 2758) @@ -38,6 +38,7 @@ import org.dllearner.core.ReasonerComponent; import org.dllearner.core.configurators.CELOEConfigurator; import org.dllearner.core.options.BooleanConfigOption; +import org.dllearner.core.options.CommonConfigMappings; import org.dllearner.core.options.CommonConfigOptions; import org.dllearner.core.options.ConfigOption; import org.dllearner.core.options.DoubleConfigOption; @@ -183,7 +184,9 @@ options.add(new BooleanConfigOption("writeSearchTree", "specifies whether to write a search tree", false)); options.add(new StringConfigOption("searchTreeFile","file to use for the search tree", "log/searchTree.txt")); options.add(new BooleanConfigOption("replaceSearchTree","specifies whether to replace the search tree in the log file after each run or append the new search tree", false)); - options.add(new DoubleConfigOption("expansionPenaltyFactor","heuristic penalty per syntactic construct used (lower = finds more complex expression, but might miss simple ones)", 0.1)); + options.add(new DoubleConfigOption("expansionPenaltyFactor","heuristic penalty per syntactic construct used (lower = finds more complex expression, but might miss simple ones)", 0.1)); + options.add(CommonConfigOptions.allowedConcepts()); + options.add(CommonConfigOptions.ignoredConcepts()); return options; } @@ -193,9 +196,26 @@ @Override public void init() throws ComponentInitException { + + // compute used concepts/roles from allowed/ignored + // concepts/roles + Set<NamedClass> usedConcepts; + Set<NamedClass> allowedConcepts = CommonConfigMappings.getAtomicConceptSet(configurator.getAllowedConcepts()); + Set<NamedClass> ignoredConcepts = CommonConfigMappings.getAtomicConceptSet(configurator.getIgnoredConcepts()); + if(allowedConcepts != null) { + // sanity check to control if no non-existing concepts are in the list + Helper.checkConcepts(reasoner, allowedConcepts); + usedConcepts = allowedConcepts; + } else if(ignoredConcepts != null) { + usedConcepts = Helper.computeConceptsUsingIgnoreList(reasoner, ignoredConcepts); + } else { + usedConcepts = Helper.computeConcepts(reasoner); + } + // copy class hierarchy and modify it such that each class is only // reachable via a single path - ClassHierarchy classHierarchy = reasoner.getClassHierarchy().clone(); +// ClassHierarchy classHierarchy = reasoner.getClassHierarchy().clone(); + ClassHierarchy classHierarchy = reasoner.getClassHierarchy().cloneAndRestrict(usedConcepts); classHierarchy.thinOutSubsumptionHierarchy(); heuristic = new OEHeuristicRuntime(configurator); Modified: trunk/components-core/src/main/java/org/dllearner/core/configurators/CELOEConfigurator.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/configurators/CELOEConfigurator.java 2011-04-05 17:03:24 UTC (rev 2757) +++ trunk/components-core/src/main/java/org/dllearner/core/configurators/CELOEConfigurator.java 2011-04-06 07:07:20 UTC (rev 2758) @@ -20,6 +20,7 @@ package org.dllearner.core.configurators; +import java.util.Set; import org.dllearner.algorithms.celoe.CELOE; import org.dllearner.core.ComponentManager; import org.dllearner.core.LearningProblem; @@ -137,7 +138,7 @@ return (Boolean) ComponentManager.getInstance().getConfigOptionValue(cELOE, "useBooleanDatatypes") ; } /** -* useDoubleDatatypes specifies whether boolean datatypes are used in the learning algorothm. +* useDoubleDatatypes specifies whether double datatypes are used in the learning algorothm. * mandatory: false| reinit necessary: true * default value: true * @return boolean @@ -271,6 +272,26 @@ public double getExpansionPenaltyFactor() { return (Double) ComponentManager.getInstance().getConfigOptionValue(cELOE, "expansionPenaltyFactor") ; } +/** +* allowedConcepts concepts the algorithm is allowed to use. +* mandatory: false| reinit necessary: true +* default value: null +* @return Set(String) +**/ +@SuppressWarnings("unchecked") +public Set<String> getAllowedConcepts() { +return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(cELOE, "allowedConcepts") ; +} +/** +* ignoredConcepts concepts the algorithm must ignore. +* mandatory: false| reinit necessary: true +* default value: null +* @return Set(String) +**/ +@SuppressWarnings("unchecked") +public Set<String> getIgnoredConcepts() { +return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(cELOE, "ignoredConcepts") ; +} /** * @param useAllConstructor specifies whether the universal concept constructor is used in the learning algorithm. @@ -354,7 +375,7 @@ reinitNecessary = true; } /** -* @param useDoubleDatatypes specifies whether boolean datatypes are used in the learning algorothm. +* @param useDoubleDatatypes specifies whether double datatypes are used in the learning algorothm. * mandatory: false| reinit necessary: true * default value: true **/ @@ -488,6 +509,24 @@ ComponentManager.getInstance().applyConfigEntry(cELOE, "expansionPenaltyFactor", expansionPenaltyFactor); reinitNecessary = true; } +/** +* @param allowedConcepts concepts the algorithm is allowed to use. +* mandatory: false| reinit necessary: true +* default value: null +**/ +public void setAllowedConcepts(Set<String> allowedConcepts) { +ComponentManager.getInstance().applyConfigEntry(cELOE, "allowedConcepts", allowedConcepts); +reinitNecessary = true; +} +/** +* @param ignoredConcepts concepts the algorithm must ignore. +* mandatory: false| reinit necessary: true +* default value: null +**/ +public void setIgnoredConcepts(Set<String> ignoredConcepts) { +ComponentManager.getInstance().applyConfigEntry(cELOE, "ignoredConcepts", ignoredConcepts); +reinitNecessary = true; +} /** * true, if this component needs reinitializsation. Modified: trunk/components-core/src/main/java/org/dllearner/core/configurators/ISLEConfigurator.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/configurators/ISLEConfigurator.java 2011-04-05 17:03:24 UTC (rev 2757) +++ trunk/components-core/src/main/java/org/dllearner/core/configurators/ISLEConfigurator.java 2011-04-06 07:07:20 UTC (rev 2758) @@ -137,7 +137,7 @@ return (Boolean) ComponentManager.getInstance().getConfigOptionValue(iSLE, "useBooleanDatatypes") ; } /** -* useDoubleDatatypes specifies whether boolean datatypes are used in the learning algorothm. +* useDoubleDatatypes specifies whether double datatypes are used in the learning algorothm. * mandatory: false| reinit necessary: true * default value: true * @return boolean @@ -300,7 +300,7 @@ reinitNecessary = true; } /** -* @param useDoubleDatatypes specifies whether boolean datatypes are used in the learning algorothm. +* @param useDoubleDatatypes specifies whether double datatypes are used in the learning algorothm. * mandatory: false| reinit necessary: true * default value: true **/ Modified: trunk/components-core/src/main/java/org/dllearner/core/configurators/OCELConfigurator.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/configurators/OCELConfigurator.java 2011-04-05 17:03:24 UTC (rev 2757) +++ trunk/components-core/src/main/java/org/dllearner/core/configurators/OCELConfigurator.java 2011-04-06 07:07:20 UTC (rev 2758) @@ -277,7 +277,7 @@ return (Boolean) ComponentManager.getInstance().getConfigOptionValue(oCEL, "useBooleanDatatypes") ; } /** -* useDoubleDatatypes specifies whether boolean datatypes are used in the learning algorothm. +* useDoubleDatatypes specifies whether double datatypes are used in the learning algorothm. * mandatory: false| reinit necessary: true * default value: true * @return boolean @@ -647,7 +647,7 @@ reinitNecessary = true; } /** -* @param useDoubleDatatypes specifies whether boolean datatypes are used in the learning algorothm. +* @param useDoubleDatatypes specifies whether double datatypes are used in the learning algorothm. * mandatory: false| reinit necessary: true * default value: true **/ Modified: trunk/components-core/src/main/java/org/dllearner/core/configurators/PosNegLPStandardConfigurator.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/configurators/PosNegLPStandardConfigurator.java 2011-04-05 17:03:24 UTC (rev 2757) +++ trunk/components-core/src/main/java/org/dllearner/core/configurators/PosNegLPStandardConfigurator.java 2011-04-06 07:07:20 UTC (rev 2758) @@ -75,7 +75,7 @@ return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(posNegLPStandard, "negativeExamples") ; } /** -* useRetrievalForClassficiation Specifies whether to use retrieval or instance checks for testing a concept.. +* useRetrievalForClassficiation Specifies whether to use retrieval or instance checks for testing a concept. - NO LONGER FULLY SUPPORTED.. * mandatory: false| reinit necessary: true * default value: false * @return boolean @@ -93,7 +93,7 @@ return (Double) ComponentManager.getInstance().getConfigOptionValue(posNegLPStandard, "percentPerLenghtUnit") ; } /** -* useMultiInstanceChecks See UseMultiInstanceChecks enum.. +* useMultiInstanceChecks See UseMultiInstanceChecks enum. - NO LONGER FULLY SUPPORTED.. * mandatory: false| reinit necessary: true * default value: twoChecks * @return String @@ -146,7 +146,7 @@ ComponentManager.getInstance().applyConfigEntry(posNegLPStandard, "negativeExamples", negativeExamples); } /** -* @param useRetrievalForClassficiation Specifies whether to use retrieval or instance checks for testing a concept.. +* @param useRetrievalForClassficiation Specifies whether to use retrieval or instance checks for testing a concept. - NO LONGER FULLY SUPPORTED.. * mandatory: false| reinit necessary: true * default value: false **/ @@ -164,7 +164,7 @@ reinitNecessary = true; } /** -* @param useMultiInstanceChecks See UseMultiInstanceChecks enum.. +* @param useMultiInstanceChecks See UseMultiInstanceChecks enum. - NO LONGER FULLY SUPPORTED.. * mandatory: false| reinit necessary: true * default value: twoChecks **/ Modified: trunk/components-core/src/main/java/org/dllearner/core/configurators/PosNegLPStrictConfigurator.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/configurators/PosNegLPStrictConfigurator.java 2011-04-05 17:03:24 UTC (rev 2757) +++ trunk/components-core/src/main/java/org/dllearner/core/configurators/PosNegLPStrictConfigurator.java 2011-04-06 07:07:20 UTC (rev 2758) @@ -75,7 +75,7 @@ return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(posNegLPStrict, "negativeExamples") ; } /** -* useRetrievalForClassficiation Specifies whether to use retrieval or instance checks for testing a concept.. +* useRetrievalForClassficiation Specifies whether to use retrieval or instance checks for testing a concept. - NO LONGER FULLY SUPPORTED.. * mandatory: false| reinit necessary: true * default value: false * @return boolean @@ -93,7 +93,7 @@ return (Double) ComponentManager.getInstance().getConfigOptionValue(posNegLPStrict, "percentPerLenghtUnit") ; } /** -* useMultiInstanceChecks See UseMultiInstanceChecks enum.. +* useMultiInstanceChecks See UseMultiInstanceChecks enum. - NO LONGER FULLY SUPPORTED.. * mandatory: false| reinit necessary: true * default value: twoChecks * @return String @@ -146,7 +146,7 @@ ComponentManager.getInstance().applyConfigEntry(posNegLPStrict, "negativeExamples", negativeExamples); } /** -* @param useRetrievalForClassficiation Specifies whether to use retrieval or instance checks for testing a concept.. +* @param useRetrievalForClassficiation Specifies whether to use retrieval or instance checks for testing a concept. - NO LONGER FULLY SUPPORTED.. * mandatory: false| reinit necessary: true * default value: false **/ @@ -164,7 +164,7 @@ reinitNecessary = true; } /** -* @param useMultiInstanceChecks See UseMultiInstanceChecks enum.. +* @param useMultiInstanceChecks See UseMultiInstanceChecks enum. - NO LONGER FULLY SUPPORTED.. * mandatory: false| reinit necessary: true * default value: twoChecks **/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |