com.rapidminer.operator.features.construction
Class ExampleSetBasedFeatureOperator

java.lang.Object
  extended by com.rapidminer.operator.Operator
      extended by com.rapidminer.operator.OperatorChain
          extended by com.rapidminer.operator.features.construction.ExampleSetBasedFeatureOperator
All Implemented Interfaces:
ConfigurationListener, PreviewListener, ParameterHandler, LoggingHandler
Direct Known Subclasses:
AbstractGeneratingGeneticAlgorithm

public abstract class ExampleSetBasedFeatureOperator
extends OperatorChain

This class is the superclass of all feature selection and generation operators. It provides an easy to use plug-in interface for operators that modify populations. Subclasses just have to supply lists of PopulationOperators by overriding getPreEvalutaionPopulationOperators() and getPostEvalutaionPopulationOperators() during a loop which will terminate if solutionGoodEnough() returns true.

Author:
Ingo Mierswa

Field Summary
static java.lang.String PARAMETER_LOCAL_RANDOM_SEED
           
static java.lang.String PARAMETER_MAXIMAL_FITNESS
           
static java.lang.String PARAMETER_SHOW_STOP_DIALOG
           
 
Constructor Summary
ExampleSetBasedFeatureOperator(OperatorDescription description)
           
 
Method Summary
 IOObject[] apply()
          Applies the feature operator: collects the pre- and postevaluation operators create an initial population evaluate the initial population loop as long as solution is not good enough apply all pre evaluation operators evaluate the population update the population's best individual apply all post evaluation operators return all generation's best individual
abstract  ExampleSetBasedPopulation createInitialPopulation(ExampleSet es)
          Create an initial population.
protected  PerformanceVector evaluate(ExampleSetBasedIndividual individual)
          Evaluates the given individual.
protected  void evaluate(ExampleSetBasedPopulation population)
          Evaluates all individuals in the population by applying the inner operators.
protected  boolean getCheckForMaximum()
          Returns if the operator should check if the maximum was reached for the main criterion.
 InnerOperatorCondition getInnerOperatorCondition()
          Must return a condition of the IO behaviour of all desired inner operators.
 java.lang.Class<?>[] getInputClasses()
          Returns the classes that are needed as input.
 int getMaxNumberOfInnerOperators()
          Returns the highest possible value for the maximum number of innner operators.
 int getMinNumberOfInnerOperators()
          Returns 0 for the minimum number of innner operators.
 java.lang.Class<?>[] getOutputClasses()
          Returns the classes that are guaranteed to be returned by apply() as additional output.
 java.util.List<ParameterType> getParameterTypes()
          Returns a list of ParameterTypes describing the parameters of this operator.
protected  ExampleSetBasedPopulation getPopulation()
           
abstract  java.util.List<ExampleSetBasedPopulationOperator> getPostEvaluationPopulationOperators(ExampleSet input)
          Must return a list of PopulationOperators.
abstract  java.util.List<ExampleSetBasedPopulationOperator> getPreEvaluationPopulationOperators(ExampleSet input)
          Must return a list of PopulationOperators.
protected  RandomGenerator getRandom()
           
protected  void setCheckForMaximum(boolean checkForMaximalFitness)
          Sets if the operator should check if the maximum was reached for the main criterion.
abstract  boolean solutionGoodEnough(ExampleSetBasedPopulation pop)
          Has to return true if the main loop can be stopped because a solution is concidered to be good enough according to some criterion.
 
Methods inherited from class com.rapidminer.operator.OperatorChain
addAddListener, addOperator, addOperator, checkDeprecations, checkIO, checkNumberOfInnerOperators, checkProperties, clearErrorList, cloneOperator, createExperimentTree, createProcessTree, getAllInnerOperators, getIndexOfOperator, getInnerOperatorForName, getInnerOperatorsXML, getNumberOfAllOperators, getNumberOfOperators, getOperator, getOperatorFromAll, getOperators, performAdditionalChecks, processFinished, processStarts, registerOperator, removeAddListener, removeOperator, shouldAddNonConsumedInput, shouldReturnInnerOutput, unregisterOperator
 
Methods inherited from class com.rapidminer.operator.Operator
addError, addValue, addWarning, apply, checkForStop, createExperimentTree, createFromXML, createMarkedExperimentTree, createMarkedProcessTree, createProcessTree, getAddOnlyAdditionalOutput, getApplyCount, getDeliveredOutputClasses, getDeprecationInfo, getDesiredInputClasses, getEncoding, getErrorList, getExperiment, getInput, getInput, getInput, getInputDescription, getIOContainerForInApplyLoopBreakpoint, getIODescription, getLog, getName, getOperatorClassName, getOperatorDescription, getParameter, getParameterAsBoolean, getParameterAsColor, getParameterAsDouble, getParameterAsFile, getParameterAsFile, getParameterAsInputStream, getParameterAsInt, getParameterAsMatrix, getParameterAsString, getParameterList, getParameters, getParameterType, getParent, getProcess, getStartTime, getStatus, getUserDescription, getValue, getValues, getXML, hasBreakpoint, hasBreakpoint, hasInput, inApplyLoop, isDebugMode, isEnabled, isExpanded, isParallel, isParameterSet, log, logError, logNote, logWarning, register, remove, rename, resume, setApplyCount, setBreakpoint, setEnabled, setExpanded, setInput, setListParameter, setOperatorParameters, setParameter, setParameters, setParent, setUserDescription, toString, writeXML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PARAMETER_LOCAL_RANDOM_SEED

public static final java.lang.String PARAMETER_LOCAL_RANDOM_SEED
See Also:
Constant Field Values

PARAMETER_SHOW_STOP_DIALOG

public static final java.lang.String PARAMETER_SHOW_STOP_DIALOG
See Also:
Constant Field Values

PARAMETER_MAXIMAL_FITNESS

public static final java.lang.String PARAMETER_MAXIMAL_FITNESS
See Also:
Constant Field Values
Constructor Detail

ExampleSetBasedFeatureOperator

public ExampleSetBasedFeatureOperator(OperatorDescription description)
Method Detail

createInitialPopulation

public abstract ExampleSetBasedPopulation createInitialPopulation(ExampleSet es)
                                                           throws OperatorException
Create an initial population. The example set will be cloned before the method is invoked. This method is invoked after the pre- and postevaluation population operators were collected.

Throws:
OperatorException

getPreEvaluationPopulationOperators

public abstract java.util.List<ExampleSetBasedPopulationOperator> getPreEvaluationPopulationOperators(ExampleSet input)
                                                                                               throws OperatorException
Must return a list of PopulationOperators. All operators are applied to the population in their order within the list before the population is evaluated. Since this method is invoked only once the list cannot by dynamically changed during runtime.

Throws:
OperatorException

getPostEvaluationPopulationOperators

public abstract java.util.List<ExampleSetBasedPopulationOperator> getPostEvaluationPopulationOperators(ExampleSet input)
                                                                                                throws OperatorException
Must return a list of PopulationOperators. All operators are applied to the population in their order within the list after the population is evaluated. Since this method is invoked only once the list cannot by dynamically changed during runtime.

Throws:
OperatorException

solutionGoodEnough

public abstract boolean solutionGoodEnough(ExampleSetBasedPopulation pop)
                                    throws OperatorException
Has to return true if the main loop can be stopped because a solution is concidered to be good enough according to some criterion.

Throws:
OperatorException

getOutputClasses

public java.lang.Class<?>[] getOutputClasses()
Description copied from class: Operator

Returns the classes that are guaranteed to be returned by apply() as additional output. Please note that input objects which should not be consumed must also be defined by this method (e.g. an example set which is changed but not consumed in the case of a preprocessing operator must be defined in both, the methods Operator.getInputClasses() and Operator.getOutputClasses()). The default behavior for input consumation is defined by Operator.getInputDescription(Class) and can be changed by overwriting this method. Objects which are not consumed (defined by changing the implementation in Operator.getInputDescription(Class)) must not be defined as additional output in this method.

May deliver null or an empy array (no additional output is produced or guaranteed). Must return the class array of delivered output objects otherwise.

Specified by:
getOutputClasses in class Operator

getInputClasses

public java.lang.Class<?>[] getInputClasses()
Description copied from class: Operator
Returns the classes that are needed as input. May be null or an empty (no desired input). As default, all delivered input objects are consumed and must be also delivered as output in both Operator.getOutputClasses() and Operator.apply() if this is necessary. This default behavior can be changed by overriding Operator.getInputDescription(Class). Subclasses which implement this method should not make use of parameters since this method is invoked by getParameterTypes(). Therefore, parameters are not fully available at this point of time and this might lead to exceptions. Please use InputDescriptions instead.

Specified by:
getInputClasses in class Operator

getInnerOperatorCondition

public InnerOperatorCondition getInnerOperatorCondition()
Description copied from class: OperatorChain
Must return a condition of the IO behaviour of all desired inner operators. If there are no "special" conditions and the chain works similar to a simple operator chain this method should at least return a SimpleChainInnerOperatorCondition. More than one condition should be combined with help of the class CombinedInnerOperatorCondition.

Specified by:
getInnerOperatorCondition in class OperatorChain

getRandom

protected RandomGenerator getRandom()

getPopulation

protected ExampleSetBasedPopulation getPopulation()

apply

public IOObject[] apply()
                 throws OperatorException
Applies the feature operator:
  1. collects the pre- and postevaluation operators
  2. create an initial population
  3. evaluate the initial population
  4. loop as long as solution is not good enough
    1. apply all pre evaluation operators
    2. evaluate the population
    3. update the population's best individual
    4. apply all post evaluation operators
  5. return all generation's best individual

Overrides:
apply in class OperatorChain
Returns:
the last inner operator's output or the input itself if the chain is empty.
Throws:
OperatorException

evaluate

protected void evaluate(ExampleSetBasedPopulation population)
                 throws OperatorException
Evaluates all individuals in the population by applying the inner operators.

Throws:
OperatorException

evaluate

protected PerformanceVector evaluate(ExampleSetBasedIndividual individual)
                              throws OperatorException
Evaluates the given individual. The performance is set as user data of the individual and also returned by this method.

Throws:
OperatorException

setCheckForMaximum

protected void setCheckForMaximum(boolean checkForMaximalFitness)
Sets if the operator should check if the maximum was reached for the main criterion. Subclasses may want to set this to false, e.g. for multiobjective optimization.


getCheckForMaximum

protected boolean getCheckForMaximum()
Returns if the operator should check if the maximum was reached for the main criterion. Subclasses may want to set this to false, e.g. for multiobjective optimization.


getMaxNumberOfInnerOperators

public int getMaxNumberOfInnerOperators()
Returns the highest possible value for the maximum number of innner operators.

Specified by:
getMaxNumberOfInnerOperators in class OperatorChain

getMinNumberOfInnerOperators

public int getMinNumberOfInnerOperators()
Returns 0 for the minimum number of innner operators.

Specified by:
getMinNumberOfInnerOperators in class OperatorChain

getParameterTypes

public java.util.List<ParameterType> getParameterTypes()
Description copied from class: Operator
Returns a list of ParameterTypes describing the parameters of this operator. The default implementation returns an empty list if no input objects can be retained and special parameters for those input objects which can be prevented from being consumed.

Specified by:
getParameterTypes in interface ParameterHandler
Overrides:
getParameterTypes in class Operator


Copyright © 2001-2009 by Rapid-I