Branch
Synopsis
This operator consists of two subprocesses but it executes only one subprocess at a time depending upon the condition. This operator is similar to the 'if-then-else' statement, where one of the two options is selected depending upon the results of the specified condition. It is important to have understanding of subprocesses in order to use this operator effectively.
Description
The Branch operator tests the condition specified in the parameters (mostly through thecondition typeandcondition valueparameters) on the object supplied at theconditioninput port. If the condition is satisfied, the first subprocess i.e. the 'Then' subprocess is executed otherwise the second subprocess i.e. the 'Else' subprocess is executed.
It is very important to have a good understanding of use of subprocesses in RapidMiner to understand this operator completely. A subprocess introduces a process within a process. Whenever a subprocess is reached during a process execution, first the entire subprocess is executed. Once the subprocess execution is complete, the flow is returned to the process (the parent process). A subprocess can be considered as a small unit of a process, like in a process, all operators and combination of operators can be applied in a subprocess. That is why a subprocess can also be defined as a chain of operators that is subsequently applied. For more detail about subprocesses please study the
operator.
Double-click on the Branch operator to go inside and view the subprocesses. The subprocesses are then shown in the same Process View. Here you can see two subprocesses: 'Then' and 'Else' subprocesses. The 'Then' subprocess is executed if the condition specified in the parameters results true. The 'Else' subprocess is executed if the condition specified in the parameters results false. To go back to the parent process, click the blue-colored up arrow button in the Process View toolbar. This works like files and folders work in operating systems. Subprocesses can have subprocesses in them just like folders can have folders in them.
The Branch operator is similar to the
operator because they both have multiple subprocesses but only one subprocess is executed at a time. The Select Subprocess operator can have more than two subprocesses and the subprocess to be executed is specified in the parameters. On the contrary, The Branch operator has only two subprocesses and the subprocess to be executed depends upon the result of the condition specified in the parameters. The condition is specified through thecondition typeandcondition valueparameters. Macros can be provided in thecondition valueparameter. Thus the subprocess to be executed can be controlled by using macros. If this operator is placed in any Loop operator this operator will be executed multiple number of times. True power of this operator comes into play when it is used with other operators like various Macro and Loop operators. For example, if this operator is placed in any Loop operator and thecondition valueparameter is controlled by a macro then this operator can be used to dynamically change the process setup. This might be useful in order to test different layouts.
Input
condition
Any object can be supplied at this port. The condition specified in the parameters is tested on this object. If the condition is satisfied the 'Then' subprocess is executed otherwise the 'Else' subprocess is executed
input
The Branch operator can have multiple inputs. When one input is connected, anotherinputport becomes available which is ready to accept another input (if any). The order of inputs remains the same. The Object supplied at the firstinputport of the Branch operator is available at the firstinput嵌套链的端口(在子流程)。Don't forget to connect all inputs in correct order. Make sure that you have connected the right number of ports at all levels of the chain.
Output
input
The Branch operator can have multiple outputs. When one output is connected, anotherinputport becomes available which is ready to deliver another output (if any). The order of outputs remains the same. The Object delivered at the firstinput港子流程是第一次交货inputof the Branch operator. 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
Condition type
The type of condition is selected through this parameter.
Condition value
The value of the selected condition type is specified through this parameter. Thecondition typeandcondition valueparameters together specify the condition statement. This condition will be tested on the object provided at theconditioninput port.
Io object
This parameter is only available when thecondition typeparameter is set to 'input exists'. This parameter specifies the class of the object which should be checked for existence.
Return inner output
This parameter indicates if the outputs of the inner subprocess should be delivered through this operator.