com.rapidminer.operator.meta
Class ParameterIteration

java.lang.Object
  extended by com.rapidminer.operator.Operator
      extended by com.rapidminer.operator.OperatorChain
          extended by com.rapidminer.operator.meta.ParameterIteratingOperatorChain
              extended by com.rapidminer.operator.meta.ParameterIteration
All Implemented Interfaces:
ConfigurationListener, PreviewListener, ParameterHandler, LoggingHandler

public class ParameterIteration
extends ParameterIteratingOperatorChain

In contrast to the GridSearchParameterOptimizationOperator operator this operators simply uses the defined parameters and perform the inner operators for all possible combinations. This can be especially usefull for plotting or logging purposes and sometimes also for simply configuring the parameters for the inner operators as a sort of meta step (e.g. learning curve generation).

This operator iterates through a set of parameters by using all possible parameter combinations. The parameter parameters is a list of key value pairs where the keys are of the form operator_name.parameter_name and the value is either a comma separated list of values (e.g. 10,15,20,25) or an interval definition in the format [start;end;stepsize] (e.g. [10;25;5]). Additionally, the format [start;end;steps;scale] is allowed.

Please note that this operator has two modes: synchronized and non-synchronized. In the latter, all parameter combinations are generated and the inner operators are applied for each combination. In the synchronized mode, no combinations are generated but the set of all pairs of the increasing number of parameters are used. For the iteration over a single parameter there is no difference between both modes. Please note that the number of parameter possibilities must be the same for all parameters in the synchronized mode.

Author:
Ingo Mierswa, Tobias Malbrecht Exp $

Field Summary
static java.lang.String PARAMETER_KEEP_OUTPUT
          The parameter name for "Keep the output of the last operator in the operator chain"
static java.lang.String PARAMETER_PARAMETERS
          The parameter name for "A list of parameters to optimize"
static java.lang.String PARAMETER_SYNCHRONIZE
          The parameter name for "Synchronize parameter iteration"
 
Fields inherited from class com.rapidminer.operator.meta.ParameterIteratingOperatorChain
PARAMETER_VALUES, VALUE_MODE_CONTINUOUS, VALUE_MODE_DISCRETE
 
Constructor Summary
ParameterIteration(OperatorDescription description)
           
 
Method Summary
 IOObject[] apply()
          Applies all inner operators.
 InnerOperatorCondition getInnerOperatorCondition()
          Returns a simple chain condition.
 java.lang.Class<?>[] getInputClasses()
          Returns the classes that are needed as input.
 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.
 int getParameterValueMode()
          Has to return one of the predefined modes which indicate whether the operator takes discrete values or intervals as basis for optimization.
 boolean shouldAddNonConsumedInput()
           
 boolean shouldReturnInnerOutput()
          Indicates if inner output should be delivered by this operator chain.
 
Methods inherited from class com.rapidminer.operator.meta.ParameterIteratingOperatorChain
getMaxNumberOfInnerOperators, getMinNumberOfInnerOperators, parseParameterValues
 
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, 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_PARAMETERS

public static final java.lang.String PARAMETER_PARAMETERS
The parameter name for "A list of parameters to optimize"

See Also:
Constant Field Values

PARAMETER_SYNCHRONIZE

public static final java.lang.String PARAMETER_SYNCHRONIZE
The parameter name for "Synchronize parameter iteration"

See Also:
Constant Field Values

PARAMETER_KEEP_OUTPUT

public static final java.lang.String PARAMETER_KEEP_OUTPUT
The parameter name for "Keep the output of the last operator in the operator chain"

See Also:
Constant Field Values
Constructor Detail

ParameterIteration

public ParameterIteration(OperatorDescription description)
Method Detail

getParameterValueMode

public int getParameterValueMode()
Description copied from class: ParameterIteratingOperatorChain
Has to return one of the predefined modes which indicate whether the operator takes discrete values or intervals as basis for optimization. The first option is to be taken for all strategies that iterate over the given parameters. The latter option is to be taken for strategies such as an evolutionary one in which allowed ranges of parameters have to be specified.

Specified by:
getParameterValueMode in class ParameterIteratingOperatorChain

apply

public IOObject[] apply()
                 throws OperatorException
Description copied from class: OperatorChain
Applies all inner operators. The input to this operator becomes the input of the first inner operator. The latter's output is passed to the second inner operator and so on. Note to subclassers: If subclasses (for example wrappers) want to make use of this method remember to call exactly this method (super.apply()) and do not call super.apply(IOContainer) erroneously which will result in an infinite loop.

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

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

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

getInnerOperatorCondition

public InnerOperatorCondition getInnerOperatorCondition()
Returns a simple chain condition.

Specified by:
getInnerOperatorCondition in class OperatorChain

shouldReturnInnerOutput

public boolean shouldReturnInnerOutput()
Description copied from class: OperatorChain
Indicates if inner output should be delivered by this operator chain. Default is false. Operators which want to change this default behaviour should override this method and should return true. In this case the method checkIO would not longer return the result of Operator.getDeliveredOutputClasses() but of OperatorChain.getAllOutputClasses(Class[]).

Overrides:
shouldReturnInnerOutput in class OperatorChain

shouldAddNonConsumedInput

public boolean shouldAddNonConsumedInput()
Overrides:
shouldAddNonConsumedInput in class ParameterIteratingOperatorChain

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 ParameterIteratingOperatorChain


Copyright © 2001-2009 by Rapid-I