From: <Jen...@us...> - 2008-05-22 14:51:58
|
Revision: 922 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=922&view=rev Author: JensLehmann Date: 2008-05-22 07:51:14 -0700 (Thu, 22 May 2008) Log Message: ----------- started true posonly learning algorithm Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java trunk/src/php-examples/LearningSimple.php Added Paths: ----------- trunk/examples/family/father_posonly.conf Added: trunk/examples/family/father_posonly.conf =================================================================== --- trunk/examples/family/father_posonly.conf (rev 0) +++ trunk/examples/family/father_posonly.conf 2008-05-22 14:51:14 UTC (rev 922) @@ -0,0 +1,33 @@ +/** + * Father Example + * + * possible solution: + * male AND EXISTS hasChild.TOP + * + * Copyright (C) 2007, Jens Lehmann + */ + +/** settings **/ + + +import("father.kb"); + +problem = posOnlyDefinitionLP; +reasoner = owlAPI; +algorithm = refexamples; +refexamples.usePropernessChecks = true; +refexamples.maxPosOnlyExpansion = 4; + +refexamples.writeSearchTree = true; +refexamples.searchTreeFile = "log/posonlytest.txt"; + +/** examples **/ ++stefan ++markus ++bernd +/* +-heinz +-anna +-gabi +-michelle +*/ Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-05-22 14:10:08 UTC (rev 921) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-05-22 14:51:14 UTC (rev 922) @@ -38,6 +38,7 @@ import org.dllearner.core.config.ConfigEntry; import org.dllearner.core.config.ConfigOption; import org.dllearner.core.config.DoubleConfigOption; +import org.dllearner.core.config.IntegerConfigOption; import org.dllearner.core.config.InvalidConfigOptionValueException; import org.dllearner.core.config.StringConfigOption; import org.dllearner.core.owl.Description; @@ -112,6 +113,8 @@ private boolean useBooleanDatatypes = CommonConfigOptions.useBooleanDatatypesDefault; private double noisePercentage = 0.0; private NamedClass startClass = null; + private boolean usePropernessChecks = false; + private int maxPosOnlyExpansion = 4; //extended Options //in seconds private int maxExecutionTimeInSeconds = CommonConfigOptions.maxExecutionTimeInSecondsDefault; @@ -179,6 +182,9 @@ options.add(CommonConfigOptions.minExecutionTimeInSeconds()); options.add(CommonConfigOptions.guaranteeXgoodDescriptions()); options.add(CommonConfigOptions.getLogLevel()); + options.add(new BooleanConfigOption("usePropernessChecks", "specifies whether to check for equivalence (i.e. discard equivalent refinements)")); + options.add(new IntegerConfigOption("maxPosOnlyExpansion", "specifies how often a node in the search tree of a posonly learning problem needs to be expanded before it is" + + " considered as solution candidate")); DoubleConfigOption noisePercentage = new DoubleConfigOption("noisePercentage", "the (approximated) percentage of noise within the examples"); noisePercentage.setLowerLimit(0); noisePercentage.setUpperLimit(100); @@ -238,6 +244,10 @@ noisePercentage = (Double) entry.getValue(); } else if(name.equals("useBooleanDatatypes")) { useBooleanDatatypes = (Boolean) entry.getValue(); + } else if(name.equals("usePropernessChecks")) { + usePropernessChecks = (Boolean) entry.getValue(); + } else if(name.equals("maxPosOnlyExpansion")) { + maxPosOnlyExpansion = (Integer) entry.getValue(); } else if(name.equals("startClass")) { startClass = new NamedClass((String)entry.getValue()); }else if(name.equals("maxExecutionTimeInSeconds")) { @@ -344,6 +354,8 @@ useTooWeakList, useOverlyGeneralList, useShortConceptConstruction, + usePropernessChecks, + maxPosOnlyExpansion, maxExecutionTimeInSeconds, minExecutionTimeInSeconds, guaranteeXgoodDescriptions Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-05-22 14:10:08 UTC (rev 921) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-05-22 14:51:14 UTC (rev 922) @@ -101,7 +101,7 @@ // if no negatives are given, then one possible strategy is to find a very special concept still entailing all positive examples; // this is realised by changing the termination criterion: a concept is a solution if it has been expanded x times (x is // configurable) but no more special concept is found (all are either equivalent or too weak) - private int maxPosOnlyExpansion = 3; + private int maxPosOnlyExpansion; // search tree options private boolean writeSearchTree; @@ -125,7 +125,7 @@ // but the disadvantage of properness testing are additional reasoner // queries and a search bias towards ALL r.something because // ALL r.TOP is improper and automatically expanded further - private boolean testProperness = false; + private boolean usePropernessChecks = false; // tree traversal means to run through the most promising concepts // and connect them in an intersection to find a solution @@ -228,6 +228,8 @@ boolean useTooWeakList, boolean useOverlyGeneralList, boolean useShortConceptConstruction, + boolean usePropernessChecks, + int maxPosOnlyExpansion, int maxExecutionTimeInSeconds, int minExecutionTimeInSeconds, int guaranteeXgoodDescriptions @@ -269,7 +271,9 @@ this.useTooWeakList = useTooWeakList; this.useOverlyGeneralList = useOverlyGeneralList; this.useShortConceptConstruction = useShortConceptConstruction; + this.usePropernessChecks = usePropernessChecks; this.baseURI = rs.getBaseURI(); + this.maxPosOnlyExpansion = maxPosOnlyExpansion; this.maxExecutionTimeInSeconds = maxExecutionTimeInSeconds; this.minExecutionTimeInSeconds = minExecutionTimeInSeconds; this.guaranteeXgoodDescriptions = guaranteeXgoodDescriptions; @@ -423,6 +427,8 @@ if(bestNode.getChildren().size() == 0 || bestChild.isTooWeak()) { solutions.add(bestNode.getConcept()); System.out.println("solution: " + bestNode.getConcept()); + System.out.println("maxPosOnlyExpansion: " + maxPosOnlyExpansion); + System.out.println("best child of this node: " + bestChild); System.out.println("TODO: needs to be integrated with other stopping criteria"); System.exit(0); } @@ -616,7 +622,7 @@ Set<Description> improperConcepts = null; if(toEvaluateConcepts.size()>0) { // Test aller Konzepte auf properness (mit DIG in nur einer Anfrage) - if(testProperness) { + if(usePropernessChecks) { long propCalcReasoningStart = System.nanoTime(); improperConcepts = rs.subsumes(toEvaluateConcepts, concept); propernessTestsReasoner+=toEvaluateConcepts.size(); @@ -1131,6 +1137,15 @@ return startNode; } + // returns whether the refinement is "meaningful", i.e. the refinement actually represents a different concept + // than its parent; this is needed to determine when a positive only learning algorithm should stop (when a node + // has been expaned x times without yielding any meaningful refinements, it is considered a possible solution) + private boolean isPosOnlyRefinementMeaningful(ExampleBasedNode node, ExampleBasedNode refinement) { + Description d1 = node.getConcept(); + Description d2 = refinement.getConcept(); + return true; + } + private void handleStoppingConditions(){ solutionFound = (guaranteeXgoodDescriptions() ); solutionFound = (minExecutionTimeReached()&& solutionFound); Modified: trunk/src/php-examples/LearningSimple.php =================================================================== --- trunk/src/php-examples/LearningSimple.php 2008-05-22 14:10:08 UTC (rev 921) +++ trunk/src/php-examples/LearningSimple.php 2008-05-22 14:51:14 UTC (rev 922) @@ -30,13 +30,14 @@ // load WSDL files (has to be done due to a Java web service bug) ini_set("soap.wsdl_cache_enabled","0"); $wsdluri="http://localhost:8181/services?wsdl"; -Utilities::loadWSDLfiles($wsdluri); +// Utilities::loadWSDLfiles($wsdluri); // specifiy ontology $ontology = 'file:'.realpath("../../examples/family/father.owl"); // create DL-Learner client $client = new SoapClient("main.wsdl"); +// $client = new SoapClient($wsdluri); // load owl file in DIG reasoner (you need a running DIG reasoner) $id = $client->generateID(); @@ -65,4 +66,4 @@ echo 'OK <br />'; echo 'solution: ' . $concept; -?> \ No newline at end of file +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |