From: <ku...@us...> - 2008-08-29 21:51:24
|
Revision: 1149 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1149&view=rev Author: kurzum Date: 2008-08-29 21:51:22 +0000 (Fri, 29 Aug 2008) Log Message: ----------- server commit Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderOWL.java Modified: trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java 2008-08-29 21:36:31 UTC (rev 1148) +++ trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java 2008-08-29 21:51:22 UTC (rev 1149) @@ -69,6 +69,7 @@ private static final boolean DEVELOP = true; private static final boolean WAITFORINPUT = false; private static final boolean RANDOMNEGATIVES = false; + private static final boolean FORCESIZEOFNEG = true; static File file = new File("sembib.txt"); public static String ontologyPath = "examples/semantic_bible/NTNcombined.owl"; @@ -136,7 +137,7 @@ //double correct = () // System.out.println((positiveEx.size()*NEGFACTOR)); negativeEx.addAll(ane.getNegativeExamples( - (int) (positiveEx.size() * NEGFACTOR), DEVELOP)); + (int) (positiveEx.size() * NEGFACTOR), DEVELOP, FORCESIZEOFNEG)); if(negativeEx.size()<0) { System.out.println(target); Modified: trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderOWL.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderOWL.java 2008-08-29 21:36:31 UTC (rev 1148) +++ trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderOWL.java 2008-08-29 21:51:22 UTC (rev 1149) @@ -74,8 +74,8 @@ * @param neglimit * @return */ - public SortedSet<Individual> getNegativeExamples(int neglimit ) { - return getNegativeExamples(neglimit, false); + public SortedSet<Individual> getNegativeExamples(int neglimit, boolean forceNegLimit ) { + return getNegativeExamples(neglimit, false, forceNegLimit); } /** @@ -85,19 +85,22 @@ * * @param neglimit size of negative Example set, 0 means all, which can be quite large * @param stable decides whether neg Examples are randomly picked, default false, faster for developing, since the cache can be used + * @param forceNegLimit forces that exactly neglimit instances are returned by adding more instances * @return */ - public SortedSet<Individual> getNegativeExamples(int neglimit, boolean stable ) { + public SortedSet<Individual> getNegativeExamples(int neglimit, boolean stable, boolean forceNegLimit ) { SortedSet<Individual> negatives = new TreeSet<Individual>(); negatives.addAll(fromParallelClasses); negatives.addAll(fromRelated); negatives.addAll(fromSuperclasses); - if(negatives.isEmpty()){ + if(negatives.size()< neglimit){ makeNegativeExamplesFromAllOtherInstances(); + + negatives.addAll(SetManipulation.stableShrinkInd(fromAllOther, neglimit-negatives.size())); } - negatives.addAll(fromAllOther); + if(neglimit<=0){ logger.debug("neg Example size NO shrinking: " + negatives.size()); return negatives; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |