Loop Values
Synopsis
This operator iterates over its subprocess for all the possible values of the selected attribute. The subprocess can access the attribute value of the current iteration by a macro.
Description
The Loop Values operator has a parameter named attribute that allows you to select the required attribute of the input ExampleSet. Once the attribute is selected, the Loop Values operator applies its subprocess for each possible value of the selected attribute i.e. the subprocess executes n number of times where n is the number of possible values of the selected attribute. In all iterations the attribute value of the current iteration can be accessed using the macro specified in the iteration macro parameter. You need to have basic understanding of macros in order to apply this operator. Please study the documentation of the <reference key="operator.extract_macro">Extract Macro</reference>
operator for basic understanding of macros. The Extract Macro operator is also used in the attached Example Process. For more information regarding subprocesses please study the <reference key="operator.subprocess">Subprocess</reference>
operator.
It is important to note that the subprocess of the Loop Values operator executes for all possible values of the selected attribute. Suppose the selected attribute has three possible values and the ExampleSet has 100 examples. The Loop Values operator will iterate only three times (not 100 times); once for each possible value of the selected attribute. This operator is usually applied on nominal attributes.
Input
example set
This input port expects an ExampleSet. It is the output of the Subprocess operator in the attached Example Process. The output of other operators can also be used as input.
Output
output
The Loop Values operator can have multiple outputs. When one output is connected, another output port becomes available which is ready to deliver another output (if any). The order of outputs remains the same. The Object delivered at first output port of subprocess is delivered at first output of the outer process. Don't forget to connect all outputs in correct order. Make sure that you have connected the right number of ports at all levels of the chain.
Parameters
Attribute
The required attribute can be selected from this option. The attribute name can be selected from the drop down box of the attribute parameter if the meta data is known.
Iteration macro
This parameter specifies the name of the macro which holds the current value of the selected attribute in each iteration.
Reuse results
Set whether to reuse the results of each iteration as the input of the next iteration. If set to true, the output of each iteration is used as input for the next iteration. For obvious reasons, this will limit the loop to run in a single thread and not make use of more CPU cores. If set to false, the input of each iteration will be the original input of the loop.
Enable parallel execution
This parameter enables the parallel execution of the subprocess. Please disable the parallel execution if you run into memory problems.