From: <jen...@us...> - 2008-08-13 07:42:36
|
Revision: 1061 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1061&view=rev Author: jenslehmann Date: 2008-08-13 07:42:33 +0000 (Wed, 13 Aug 2008) Log Message: ----------- documentation improvements Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/EvaluatedDescription.java trunk/src/dl-learner/org/dllearner/core/KnowledgeSource.java trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java trunk/src/dl-learner/org/dllearner/core/LearningProblem.java Modified: trunk/src/dl-learner/org/dllearner/core/EvaluatedDescription.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/EvaluatedDescription.java 2008-08-12 10:09:05 UTC (rev 1060) +++ trunk/src/dl-learner/org/dllearner/core/EvaluatedDescription.java 2008-08-13 07:42:33 UTC (rev 1061) @@ -91,6 +91,7 @@ /** * @see org.dllearner.core.owl.Description#getDepth() + * @return Depth of the description. */ public int getDescriptionDepth() { return description.getDepth(); @@ -98,13 +99,17 @@ /** * @see org.dllearner.core.Score#getAccuracy() + * @return Accuracy of the description. */ public double getAccuracy() { return score.getAccuracy(); } /** + * Gets the score of this description. This can be used to get + * further statistical values. * @see org.dllearner.core.Score + * @return The score object associated with this evaluated description. */ public Score getScore() { return score; @@ -112,6 +117,7 @@ /** * @see org.dllearner.core.Score#getCoveredNegatives() + * @return Negative examples covered by the description. */ public Set<Individual> getCoveredNegatives() { return score.getCoveredNegatives(); @@ -119,6 +125,7 @@ /** * @see org.dllearner.core.Score#getCoveredPositives() + * @return Positive examples covered by the description. */ public Set<Individual> getCoveredPositives() { return score.getCoveredPositives(); @@ -126,6 +133,7 @@ /** * @see org.dllearner.core.Score#getNotCoveredNegatives() + * @return Negative examples not covered by the description. */ public Set<Individual> getNotCoveredNegatives() { return score.getNotCoveredNegatives(); @@ -133,6 +141,7 @@ /** * @see org.dllearner.core.Score#getNotCoveredPositives() + * @return Positive examples not covered by the description. */ public Set<Individual> getNotCoveredPositives() { return score.getNotCoveredPositives(); Modified: trunk/src/dl-learner/org/dllearner/core/KnowledgeSource.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/KnowledgeSource.java 2008-08-12 10:09:05 UTC (rev 1060) +++ trunk/src/dl-learner/org/dllearner/core/KnowledgeSource.java 2008-08-13 07:42:33 UTC (rev 1061) @@ -1,5 +1,5 @@ /** - * Copyright (C) 2007, Jens Lehmann + * Copyright (C) 2007-2008, Jens Lehmann * * This file is part of DL-Learner. * @@ -25,17 +25,40 @@ import org.dllearner.core.owl.KB; /** - * Represents a knowledge source component. + * Represents a knowledge source component, e.g. OWL files, SPARQL Endpoints, + * Linked Data. * * @author Jens Lehmann * */ public abstract class KnowledgeSource extends Component { + /** + * Transforms this knowledge source into an internal knowledge base. + * @return An internal Knowledge base or null if this knowledge source + * does not support a conversion to an internal knowledge base. + */ public abstract KB toKB(); + /** + * Transforms this knowledge source to DIG 1.1 code according to + * <a href="http://dl.kr.org/dig/">the specification</a>. DIG is used + * for communicating with reasoners. + * + * @param kbURI The URI which is assigned to the knowledge base. The URI + * is used to refer to the knowledge base in queries (DIG supports using + * several knowledge bases). + * @return The DIG XML code. + */ public abstract String toDIG(URI kbURI); + /** + * Export the knowledge source to the specified file in the specified format. + * @param file File to store the knowledge base. + * @param format Format of the knowledge base, e.g. N-Triples. + * @throws OntologyFormatUnsupportedException Thrown if the conversion + * to the specified format is not supported by this knowledge source. + */ public abstract void export(File file, OntologyFormat format) throws OntologyFormatUnsupportedException; } Modified: trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java 2008-08-12 10:09:05 UTC (rev 1060) +++ trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java 2008-08-13 07:42:33 UTC (rev 1061) @@ -45,6 +45,14 @@ public abstract class LearningAlgorithm extends Component { /** + * This is the maximum number of results, which the learning + * algorithms need to keep. (Often algorithms do not need + * to store any results except the best one, so this limit + * is used to limit the performance cost for storing results.) + */ + public static final int MAX_NR_OF_RESULTS = 100; + + /** * Starts the algorithm. It runs until paused, stopped, or * a termination criterion has been reached. */ @@ -90,11 +98,13 @@ /** * @see #getCurrentlyBestEvaluatedDescription() + * @return The best class description found by the learning algorithm so far. */ public abstract Description getCurrentlyBestDescription(); /** * @see #getCurrentlyBestEvaluatedDescriptions() + * @return The best class descriptions found by the learning algorithm so far. */ public List<Description> getCurrentlyBestDescriptions() { List<Description> ds = new LinkedList<Description>(); @@ -104,6 +114,8 @@ /** * @see #getCurrentlyBestEvaluatedDescriptions(int) + * @param nrOfDescriptions Limit for the number or returned descriptions. + * @return The best class descriptions found by the learning algorithm so far. */ public synchronized List<Description> getCurrentlyBestDescriptions(int nrOfDescriptions) { return getCurrentlyBestDescriptions(nrOfDescriptions, false); @@ -111,16 +123,22 @@ /** * @see #getCurrentlyBestEvaluatedDescriptions(int,double,boolean) + * @param nrOfDescriptions Limit for the number or returned descriptions. + * @param filterNonMinimalDescriptions Remove non-minimal descriptions (e.g. those which can be shortened + * to an equivalent concept) from the returned set. + * @return The best class descriptions found by the learning algorithm so far. */ public synchronized List<Description> getCurrentlyBestDescriptions(int nrOfDescriptions, boolean filterNonMinimalDescriptions) { List<Description> currentlyBest = getCurrentlyBestDescriptions(); List<Description> returnList = new LinkedList<Description>(); for(Description ed : currentlyBest) { - if(returnList.size() >= nrOfDescriptions) + if(returnList.size() >= nrOfDescriptions) { return returnList; + } - if(!filterNonMinimalDescriptions || ConceptTransformation.isDescriptionMinimal(ed)) + if(!filterNonMinimalDescriptions || ConceptTransformation.isDescriptionMinimal(ed)) { returnList.add(ed); + } } return returnList; @@ -169,15 +187,18 @@ // once we hit a description with a below threshold accuracy, we simply return // because learning algorithms are advised to order descriptions by accuracy, // so we won't find any concept with higher accuracy in the remaining list - if(ed.getAccuracy() < accuracyThreshold) + if(ed.getAccuracy() < accuracyThreshold) { return returnList; + } // return if we have sufficiently many descriptions - if(returnList.size() >= nrOfDescriptions) + if(returnList.size() >= nrOfDescriptions) { return returnList; + } - if(!filterNonMinimalDescriptions || ConceptTransformation.isDescriptionMinimal(ed.getDescription())) + if(!filterNonMinimalDescriptions || ConceptTransformation.isDescriptionMinimal(ed.getDescription())) { returnList.add(ed); + } } return returnList; @@ -203,7 +224,9 @@ } /** - * Returns all learning problems supported by this component. + * Returns all learning problems supported by this component. This can be used to indicate that, e.g. + * an algorithm is only suitable for positive only learning. + * @return All classes implementing learning problems, which are supported by this learning algorithm. */ public static Collection<Class<? extends LearningProblem>> supportedLearningProblems() { return new LinkedList<Class<? extends LearningProblem>>(); Modified: trunk/src/dl-learner/org/dllearner/core/LearningProblem.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/LearningProblem.java 2008-08-12 10:09:05 UTC (rev 1060) +++ trunk/src/dl-learner/org/dllearner/core/LearningProblem.java 2008-08-13 07:42:33 UTC (rev 1061) @@ -42,6 +42,10 @@ */ public abstract class LearningProblem extends Component { + /** + * Implementations of learning problems can use this class + * variable to perform reasoner operations. + */ protected ReasoningService reasoningService; /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |