org.dllearner.core
Class AbstractCELA

java.lang.Object
  extended by org.dllearner.core.AbstractComponent
      extended by org.dllearner.core.AbstractCELA
All Implemented Interfaces:
ClassExpressionLearningAlgorithm, Component, LearningAlgorithm, StoppableLearningAlgorithm
Direct Known Subclasses:
BruteForceLearner, CELOE, ELLearningAlgorithm, ELLearningAlgorithmDisjunctive, FuzzyCELOE, GP, ISLE, OCEL, RandomGuesser, ROLearner

public abstract class AbstractCELA
extends AbstractComponent
implements ClassExpressionLearningAlgorithm, StoppableLearningAlgorithm

Abstract superclass of all class expression learning algorithm implementations. Includes support for anytime learning algorithms and resumable learning algorithms. Provides methods for filtering the best descriptions found by the algorithm. As results of the algorithm, you can either get only descriptions or evaluated descriptions. Evaluated descriptions have information about accuracy and example coverage associated with them. However, retrieving those may require addition reasoner queries, because the learning algorithms usually use but do not necessarily store this information. Changes (March/April 2011): Learning algorithms no longer have to use this class, but it still serves as a prototypical template for class expression learning algorithms.

Author:
Jens Lehmann

Field Summary
static int MAX_NR_OF_RESULTS
          This is the maximum number of results, which the learning algorithms are asked to store.
 
Constructor Summary
AbstractCELA(AbstractLearningProblem learningProblem, AbstractReasonerComponent reasoningService)
          Each learning algorithm gets a learning problem and a reasoner as input.
 
Method Summary
 void changeLearningProblem(AbstractLearningProblem learningProblem)
          Call this when you want to change the learning problem, but leave everything else as is.
 void changeReasonerComponent(AbstractReasonerComponent reasoningService)
          Call this when you want to change the reasoning service, but leave everything else as is.
abstract  Description getCurrentlyBestDescription()
           
 List<Description> getCurrentlyBestDescriptions()
           
 List<Description> getCurrentlyBestDescriptions(int nrOfDescriptions)
           
 List<Description> getCurrentlyBestDescriptions(int nrOfDescriptions, boolean filterNonMinimalDescriptions)
           
abstract  EvaluatedDescription getCurrentlyBestEvaluatedDescription()
          Returns the best descriptions obtained so far.
 TreeSet<? extends EvaluatedDescription> getCurrentlyBestEvaluatedDescriptions()
          Returns a sorted set of the best descriptions found so far.
 List<? extends EvaluatedDescription> getCurrentlyBestEvaluatedDescriptions(double accuracyThreshold)
          Returns a fraction of class descriptions with sufficiently high accuracy.
 List<? extends EvaluatedDescription> getCurrentlyBestEvaluatedDescriptions(int nrOfDescriptions)
          Return the best currently found concepts up to some maximum count (no minimality filter used).
 List<? extends EvaluatedDescription> getCurrentlyBestEvaluatedDescriptions(int nrOfDescriptions, double accuracyThreshold, boolean filterNonMinimalDescriptions)
          Returns a filtered list of currently best class descriptions.
 List<? extends EvaluatedDescription> getCurrentlyBestMostGeneralEvaluatedDescriptions()
           
static Collection<Class<? extends AbstractLearningProblem>> supportedLearningProblems()
          Returns all learning problems supported by this component.
 
Methods inherited from class org.dllearner.core.AbstractComponent
createConfigOptions, getConfigurator, getName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.dllearner.core.StoppableLearningAlgorithm
isRunning, stop
 
Methods inherited from interface org.dllearner.core.LearningAlgorithm
start
 
Methods inherited from interface org.dllearner.core.Component
init
 

Field Detail

MAX_NR_OF_RESULTS

public static final int MAX_NR_OF_RESULTS
This is the maximum number of results, which the learning algorithms are asked to store. (Note, that algorithms are not required to store any results except the best one, so this limit is used to limit the performance cost for those which choose to store results.)

See Also:
Constant Field Values
Constructor Detail

AbstractCELA

public AbstractCELA(AbstractLearningProblem learningProblem,
                    AbstractReasonerComponent reasoningService)
Each learning algorithm gets a learning problem and a reasoner as input.

Parameters:
learningProblem - The learning problem to solve.
reasoningService - The reasoner connecting to the underlying knowledge base.
Method Detail

changeLearningProblem

public void changeLearningProblem(AbstractLearningProblem learningProblem)
Call this when you want to change the learning problem, but leave everything else as is. Method can be used to apply a configured algorithm to different learning problems. Implementations, which do not only use the provided learning algorithm variable, must make sure that a call to this method indeed changes the learning problem.

Parameters:
learningProblem - The new learning problem.

changeReasonerComponent

public void changeReasonerComponent(AbstractReasonerComponent reasoningService)
Call this when you want to change the reasoning service, but leave everything else as is. Method can be used to use a configured algorithm with different reasoners. Implementations, which do not only use the provided reasoning service class variable, must make sure that a call to this method indeed changes the reasoning service.

Parameters:
reasoningService - The new reasoning service.

getCurrentlyBestDescription

public abstract Description getCurrentlyBestDescription()
Returns:
The best class description found by the learning algorithm so far.
See Also:
getCurrentlyBestEvaluatedDescription()

getCurrentlyBestDescriptions

public List<Description> getCurrentlyBestDescriptions()
Returns:
The best class descriptions found by the learning algorithm so far.
See Also:
getCurrentlyBestEvaluatedDescriptions()

getCurrentlyBestDescriptions

public List<Description> getCurrentlyBestDescriptions(int nrOfDescriptions)
Specified by:
getCurrentlyBestDescriptions in interface ClassExpressionLearningAlgorithm
Parameters:
nrOfDescriptions - Limit for the number or returned descriptions.
Returns:
The best class descriptions found by the learning algorithm so far.
See Also:
getCurrentlyBestEvaluatedDescriptions(int)

getCurrentlyBestDescriptions

public List<Description> getCurrentlyBestDescriptions(int nrOfDescriptions,
                                                      boolean filterNonMinimalDescriptions)
Parameters:
nrOfDescriptions - Limit for the number or returned descriptions.
filterNonMinimalDescriptions - Remove non-minimal descriptions (e.g. those which can be shortened to an equivalent concept) from the returned set.
Returns:
The best class descriptions found by the learning algorithm so far.
See Also:
getCurrentlyBestEvaluatedDescriptions(int,double,boolean)

getCurrentlyBestEvaluatedDescription

public abstract EvaluatedDescription getCurrentlyBestEvaluatedDescription()
Returns the best descriptions obtained so far.

Returns:
Best class description found so far.

getCurrentlyBestEvaluatedDescriptions

public TreeSet<? extends EvaluatedDescription> getCurrentlyBestEvaluatedDescriptions()
Returns a sorted set of the best descriptions found so far. We assume that they are ordered such that the best ones come in last. (In Java, iterators traverse a SortedSet in ascending order.)

Returns:
Best class descriptions found so far.

getCurrentlyBestEvaluatedDescriptions

public List<? extends EvaluatedDescription> getCurrentlyBestEvaluatedDescriptions(int nrOfDescriptions,
                                                                                  double accuracyThreshold,
                                                                                  boolean filterNonMinimalDescriptions)
Returns a filtered list of currently best class descriptions.

Parameters:
nrOfDescriptions - Maximum number of restrictions. Use Integer.MAX_VALUE if you do not want this filter to be active.
accuracyThreshold - Minimum accuracy. All class descriptions with lower accuracy are disregarded. Specify a value between 0.0 and 1.0. Use 0.0 if you do not want this filter to be active.
filterNonMinimalDescriptions - If true, non-minimal descriptions are filtered, e.g. ALL r.TOP (being equivalent to TOP), male AND male (can be shortened to male). Currently, non-minimal descriptions are just skipped, i.e. they are completely omitted from the return list. Later, implementation might be changed to return shortened versions of those descriptions.
Returns:
A list of currently best class descriptions.

getCurrentlyBestEvaluatedDescriptions

public List<? extends EvaluatedDescription> getCurrentlyBestEvaluatedDescriptions(int nrOfDescriptions)
Return the best currently found concepts up to some maximum count (no minimality filter used).

Specified by:
getCurrentlyBestEvaluatedDescriptions in interface ClassExpressionLearningAlgorithm
Parameters:
nrOfDescriptions - Maximum number of descriptions returned.
Returns:
Return value is getCurrentlyBestDescriptions(nrOfDescriptions, 0.0, false).

getCurrentlyBestEvaluatedDescriptions

public List<? extends EvaluatedDescription> getCurrentlyBestEvaluatedDescriptions(double accuracyThreshold)
Returns a fraction of class descriptions with sufficiently high accuracy.

Parameters:
accuracyThreshold - Only return solutions with this accuracy or higher.
Returns:
Return value is getCurrentlyBestDescriptions(Integer.MAX_VALUE, accuracyThreshold, false).

getCurrentlyBestMostGeneralEvaluatedDescriptions

public List<? extends EvaluatedDescription> getCurrentlyBestMostGeneralEvaluatedDescriptions()

supportedLearningProblems

public static Collection<Class<? extends AbstractLearningProblem>> supportedLearningProblems()
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.

Returns:
All classes implementing learning problems, which are supported by this learning algorithm.


SourceForge.net Logo DL-Learner is licenced under the terms of the GNU General Public License.
Copyright © 2007-2011 Jens Lehmann