From: <jen...@us...> - 2011-08-29 17:56:53
|
Revision: 3165 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3165&view=rev Author: jenslehmann Date: 2011-08-29 17:56:47 +0000 (Mon, 29 Aug 2011) Log Message: ----------- further work on OCEL and CLI; created minimal CLI example Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/algorithms/ocel/OCEL.java trunk/interfaces/src/main/java/org/dllearner/confparser3/PostProcessor.java Added Paths: ----------- trunk/examples/family/father_minimal.conf trunk/test/fuzzydll/ Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/ocel/OCEL.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/ocel/OCEL.java 2011-08-29 17:04:59 UTC (rev 3164) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/ocel/OCEL.java 2011-08-29 17:56:47 UTC (rev 3165) @@ -339,7 +339,7 @@ // adjust heuristic - + if(heuristic == null) { if(heuristicStr == "lexicographic") heuristic = new LexicographicHeuristic(); else if(heuristicStr == "flexible") { @@ -348,14 +348,14 @@ } heuristic = new FlexibleHeuristic(((PosNegLP) getLearningProblem()).getNegativeExamples().size(), ((PosNegLP) getLearningProblem()).getPercentPerLengthUnit()); } else { - //The Heuristic is now injected -// if(getLearningProblem() instanceof PosOnlyLP) { -// throw new RuntimeException("does not work with positive examples only yet"); + if(getLearningProblem() instanceof PosOnlyLP) { + throw new RuntimeException("does not work with positive examples only yet"); // heuristic = new MultiHeuristic(((PosOnlyLP) getLearningProblem()).getPositiveExamples().size(),0, negativeWeight, startNodeBonus, expansionPenaltyFactor, negationPenalty); -// } else { -// heuristic = new MultiHeuristic(((PosNegLP) getLearningProblem()).getPositiveExamples().size(),((PosNegLP) getLearningProblem()).getNegativeExamples().size(), negativeWeight, startNodeBonus, expansionPenaltyFactor, negationPenalty); -// } + } else { + heuristic = new MultiHeuristic(((PosNegLP) getLearningProblem()).getPositiveExamples().size(),((PosNegLP) getLearningProblem()).getNegativeExamples().size(), negativeWeight, startNodeBonus, expansionPenaltyFactor, negationPenalty); + } } + } // warn the user if he/she sets any non-standard heuristic, because it will just be ignored if(learningProblem instanceof PosNegLPStandard) { @@ -408,6 +408,7 @@ // create a refinement operator and pass all configuration // variables to it // RhoDRDown + if(operator == null) { operator = new RhoDRDown( reasoner, classHierarchy, @@ -427,7 +428,8 @@ useStringDatatypes, instanceBasedDisjoints ); - + } + // create an algorithm object and pass all configuration // options to it algorithm = new ROLearner2( @@ -530,7 +532,7 @@ return operator; } - @Autowired + @Autowired(required=false) public void setOperator(RhoDRDown operator) { this.operator = operator; } @@ -855,7 +857,7 @@ this.terminateOnNoiseReached = terminateOnNoiseReached; } - @Autowired + @Autowired(required=false) public void setHeuristic(ExampleBasedHeuristic heuristic) { this.heuristic = heuristic; } Added: trunk/examples/family/father_minimal.conf =================================================================== --- trunk/examples/family/father_minimal.conf (rev 0) +++ trunk/examples/family/father_minimal.conf 2011-08-29 17:56:47 UTC (rev 3165) @@ -0,0 +1,19 @@ + +// declare some prefixes to use as abbreviations +prefixes = [ ("ex","http://example.com/father#") ] + +// knowledge source definition +ks.type = "OWL File" +ks.fileName = "father.owl" + +// reasoner +reasoner.type = "fast instance checker" +reasoner.sources = { ks } + +// learning problem +lp.type = "posNegStandard" +lp.positiveExamples = { "ex:stefan", "ex:markus", "ex:martin" } +lp.negativeExamples = { "ex:heinz", "ex:anna", "ex:michelle" } + +// create learning algorithm to run +alg.type = "ocel" Modified: trunk/interfaces/src/main/java/org/dllearner/confparser3/PostProcessor.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/confparser3/PostProcessor.java 2011-08-29 17:04:59 UTC (rev 3164) +++ trunk/interfaces/src/main/java/org/dllearner/confparser3/PostProcessor.java 2011-08-29 17:56:47 UTC (rev 3165) @@ -65,10 +65,7 @@ } else if(valueObject instanceof Map) { throw new Error("Map post processing not implemented yet"); } else if(valueObject instanceof Collection){ - // Check for collections of string - if (valueObject instanceof Collection) { - processStringCollection(prefixes, (Collection<?>) valueObject); - } + processStringCollection(prefixes, (Collection<?>) valueObject); } else if(valueObject instanceof Boolean || valueObject instanceof Integer || valueObject instanceof Double) { // nothing needs to be done for booleans } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |