|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.dllearner.core.ComponentManager
public final class ComponentManager
Central manager class for DL-Learner. There are currently four types of components in DL-Learner: knowledge sources, reasoners, learning problems, and learning algorithms. For accessing these components you should create instances and configure them using this class. The component manager is implemented as a Singleton and will read the components file (containing a list of all components) at startup. This allows interfaces (command line, graphical, web service) to easily query the available components, set and get their configuration options, and run the algorithm.
| Method Summary | ||
|---|---|---|
|
applyConfigEntry(AbstractComponent component,
ConfigEntry<T> entry)
Applies a config entry to a component. |
|
|
applyConfigEntry(AbstractComponent component,
String optionName,
T value)
Convenience method for testing purposes. |
|
void |
freeAllComponents()
Frees all references to components created by ComponentManager. |
|
void |
freeComponent(AbstractComponent component)
The ComponentManager factory methods produce component
instances, which can be freed using this method. |
|
List<Class<? extends AbstractCELA>> |
getApplicableLearningAlgorithms(Class<? extends AbstractLearningProblem> learningProblem)
Returns the set of learning algorithms, which support the given learning problem type. |
|
String |
getComponentName(Class<? extends AbstractComponent> component)
Returns the name of a component. |
|
List<Class<? extends AbstractComponent>> |
getComponents()
Returns a list of all available components in this instance of ComponentManager. |
|
ConfigOption<?> |
getConfigOption(Class<? extends AbstractComponent> component,
String name)
Returns a ConfigOption object given a component and
the option name. |
|
static List<ConfigOption<?>> |
getConfigOptions(Class<? extends AbstractComponent> componentClass)
Returns the available options of the specified component. |
|
|
getConfigOptionValue(AbstractComponent component,
ConfigOption<T> option)
Gets the value of a config option of the specified component. |
|
Object |
getConfigOptionValue(AbstractComponent component,
String optionName)
Works as getConfigOptionValue(AbstractComponent, ConfigOption),
but using the name of the option instead of a ConfigOption
object. |
|
static ComponentManager |
getInstance()
Gets the singleton instance of ComponentManager. |
|
List<Class<? extends AbstractKnowledgeSource>> |
getKnowledgeSources()
Returns a list of all available knowledge sources in this instance of ComponentManager. |
|
List<Class<? extends AbstractCELA>> |
getLearningAlgorithms()
Returns a list of all available learning algorithms in this instance of ComponentManager. |
|
List<Class<? extends AbstractLearningProblem>> |
getLearningProblems()
Returns a list of all available learning problems in this instance of ComponentManager. |
|
List<AbstractComponent> |
getLiveComponents()
Retuns a list of all instanciated and registered Components |
|
List<AbstractKnowledgeSource> |
getLiveKnowledgeSources()
Retuns a list of all instanciated and registered KnowledgeSource |
|
List<AbstractCELA> |
getLiveLearningAlgorithms()
Retuns a list of all instanciated and registered LearningAlgorithm |
|
ComponentPool |
getPool()
|
|
List<Class<? extends AbstractReasonerComponent>> |
getReasonerComponents()
Returns a list of all available reasoners in this instance of ComponentManager. |
|
|
knowledgeSource(Class<T> source)
Factory method for creating a knowledge source. |
|
|
learningAlgorithm(Class<T> laClass,
AbstractLearningProblem lp,
AbstractReasonerComponent rs)
Factory method for creating a learning algorithm, which automagically calls the right constructor for the given problem. |
|
|
learningProblem(Class<T> lpClass,
AbstractReasonerComponent reasoner)
Factory method for creating a learning problem component. |
|
|
reasoner(Class<T> reasoner,
AbstractKnowledgeSource... sources)
Factory method for creating a reasoner component from a set of knowledge sources. |
|
|
reasoner(Class<T> reasoner,
AbstractKnowledgeSource source)
Factory method for creating a reasoner component from a single knowledge source. |
|
|
reasoner(Class<T> reasoner,
Set<AbstractKnowledgeSource> sources)
Factory method for creating a reasoner component from a set of knowledge sources. |
|
static void |
setComponentClasses(String[] componentClasses)
Set the classes, which can be used as components. |
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static ComponentManager getInstance()
ComponentManager.
ComponentManager instance.public static void setComponentClasses(String[] componentClasses)
getInstance(), otherwise
it has no effect.
componentClasses - A list of class names, e.g.
org.dllearner.refinement.ROLearner.
public <T> void applyConfigEntry(AbstractComponent component,
String optionName,
T value)
T - Type of the config option (Integer, String etc.).component - A component.optionName - The name of the config option.value - The value of the config option.public ComponentPool getPool()
public <T> boolean applyConfigEntry(AbstractComponent component,
ConfigEntry<T> entry)
T - Type of the config option.component - A component object.entry - The configuration entry to set.
public <T extends AbstractKnowledgeSource> T knowledgeSource(Class<T> source)
T - The type of this method is a subclass of knowledge source.source - A registered knowledge source component.
public <T extends AbstractReasonerComponent> T reasoner(Class<T> reasoner,
AbstractKnowledgeSource source)
T - The type of this method is a subclass of reasoner component.reasoner - A class object, where the class is subclass of ReasonerComponent.source - A knowledge source.
reasoner(Class, Set)
public <T extends AbstractReasonerComponent> T reasoner(Class<T> reasoner,
Set<AbstractKnowledgeSource> sources)
T - The type of this method is a subclass of reasoner component.reasoner - A class object, where the class is subclass of ReasonerComponent.sources - A set of knowledge sources.
reasoner(Class, AbstractKnowledgeSource)
public <T extends AbstractReasonerComponent> T reasoner(Class<T> reasoner,
AbstractKnowledgeSource... sources)
T - The type of this method is a subclass of reasoner component.reasoner - A class object, where the class is subclass of ReasonerComponent.sources - A set of knowledge sources.
reasoner(Class, AbstractKnowledgeSource)
public <T extends AbstractLearningProblem> T learningProblem(Class<T> lpClass,
AbstractReasonerComponent reasoner)
T - The type of this method is a subclass of learning problem.lpClass - A class object, where the class is a subclass of learning problem.reasoner - A reasoning service object.
public <T extends AbstractCELA> T learningAlgorithm(Class<T> laClass,
AbstractLearningProblem lp,
AbstractReasonerComponent rs)
throws LearningProblemUnsupportedException
T - The type of this method is a subclass of learning algorithm.laClass - A class object, where the class is subclass of learning algorithm.lp - A learning problem, which the algorithm should try to solve.rs - A reasoning service for querying the background knowledge of this learning problem.
LearningProblemUnsupportedException - Thrown when the learning problem and
the learning algorithm are not compatible.public void freeComponent(AbstractComponent component)
ComponentManager factory methods produce component
instances, which can be freed using this method. Calling the factory
methods without freeing components when they are not used anymore
can (in theory) cause memory problems.
component - The component to free.public void freeAllComponents()
ComponentManager.
freeComponent(AbstractComponent)
public <T> T getConfigOptionValue(AbstractComponent component,
ConfigOption<T> option)
applyConfigEntry(AbstractComponent, ConfigEntry).
If the value has not been changed, the default value for this
option is returned. Note, that this method will not work properly
if the component options are changed internally surpassing the
component manager (which is discouraged).
T - The type of the config option, e.g. String, boolean, integer.component - The component, which has the specified option.option - The option for which we want to know its value.
public Object getConfigOptionValue(AbstractComponent component,
String optionName)
getConfigOptionValue(AbstractComponent, ConfigOption),
but using the name of the option instead of a ConfigOption
object.
component - A component.optionName - A valid option name for this component.
getConfigOptionValue(AbstractComponent, ConfigOption)public static List<ConfigOption<?>> getConfigOptions(Class<? extends AbstractComponent> componentClass)
componentClass - The class object of a component.
public ConfigOption<?> getConfigOption(Class<? extends AbstractComponent> component,
String name)
ConfigOption object given a component and
the option name.
component - A component class object.name - A valid configuration option name for the component.
ConfigOption object for the specified component class and option name.public String getComponentName(Class<? extends AbstractComponent> component)
component - A component class object.
public List<Class<? extends AbstractComponent>> getComponents()
ComponentManager.
ComponentManager.public List<Class<? extends AbstractKnowledgeSource>> getKnowledgeSources()
ComponentManager.
ComponentManager.public List<Class<? extends AbstractReasonerComponent>> getReasonerComponents()
ComponentManager.
ComponentManager.public List<Class<? extends AbstractLearningProblem>> getLearningProblems()
ComponentManager.
ComponentManager.public List<Class<? extends AbstractCELA>> getApplicableLearningAlgorithms(Class<? extends AbstractLearningProblem> learningProblem)
learningProblem - A learning problem type.
public List<Class<? extends AbstractCELA>> getLearningAlgorithms()
ComponentManager.
ComponentManager.public List<AbstractComponent> getLiveComponents()
public List<AbstractCELA> getLiveLearningAlgorithms()
public List<AbstractKnowledgeSource> getLiveKnowledgeSources()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||