[SOLVED] Condtion Based Process Execution
rowan_g
New Altair Community Member
Hi,
I'm not sure if this is possible with RapidMiner but I'll ask anyway - RapidMiner continues to surprise me with it's limitless capabilities.
I want to execute an existing process using the "Execute Process" operator but only under 1 condition.
For example, If att1 contains X then execute process.
Thanks again!
Cheers,
I'm not sure if this is possible with RapidMiner but I'll ask anyway - RapidMiner continues to surprise me with it's limitless capabilities.
I want to execute an existing process using the "Execute Process" operator but only under 1 condition.
For example, If att1 contains X then execute process.
Thanks again!
Cheers,
Tagged:
0
Answers
-
Hey,
RapidMiner has a "Branch"-operator which you can use for this purpose. Inside this operator you will see two subprocesses "then" and "else". Depending on the condition either the "then"- or the "else"-subprocess will be executed. So in the "then"-case you can execute your process.
Regarding your condition you have to hack a little bit, since the "attribute_value_filter" tests all values for a value, so you can not check if it contains a value directly. But with the help of the "Filter Example" operator you can filter out all example with this value and use the "min_examples" condition. See the example process and replace the log-operators inside the branch operator accordingly.
Best
Marcin
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.009">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="5.3.009" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="generate_nominal_data" compatibility="5.3.009" expanded="true" height="60" name="Generate Nominal Data" width="90" x="45" y="75">
<parameter key="number_examples" value="10"/>
<parameter key="number_of_attributes" value="1"/>
</operator>
<operator activated="true" class="filter_examples" compatibility="5.3.009" expanded="true" height="76" name="Filter Examples" width="90" x="179" y="75">
<parameter key="condition_class" value="attribute_value_filter"/>
<parameter key="parameter_string" value="att1=value0"/>
</operator>
<operator activated="true" class="branch" compatibility="5.3.009" expanded="true" height="94" name="Branch" width="90" x="313" y="75">
<parameter key="condition_type" value="min_examples"/>
<parameter key="condition_value" value="0"/>
<process expanded="true">
<operator activated="true" class="print_to_console" compatibility="5.3.009" expanded="true" height="76" name="Execute" width="90" x="45" y="30">
<parameter key="log_value" value="Execute process"/>
</operator>
<connect from_port="condition" to_op="Execute" to_port="through 1"/>
<connect from_op="Execute" from_port="through 1" to_port="input 1"/>
<portSpacing port="source_condition" spacing="0"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="source_input 2" spacing="0"/>
<portSpacing port="sink_input 1" spacing="0"/>
<portSpacing port="sink_input 2" spacing="0"/>
</process>
<process expanded="true">
<operator activated="true" class="print_to_console" compatibility="5.3.009" expanded="true" height="76" name="Idle" width="90" x="45" y="30">
<parameter key="log_value" value="Do nothing"/>
</operator>
<connect from_port="condition" to_op="Idle" to_port="through 1"/>
<connect from_op="Idle" from_port="through 1" to_port="input 1"/>
<portSpacing port="source_condition" spacing="0"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="source_input 2" spacing="0"/>
<portSpacing port="sink_input 1" spacing="0"/>
<portSpacing port="sink_input 2" spacing="0"/>
</process>
</operator>
<connect from_op="Generate Nominal Data" from_port="output" to_op="Filter Examples" to_port="example set input"/>
<connect from_op="Filter Examples" from_port="example set output" to_op="Branch" to_port="condition"/>
<connect from_op="Filter Examples" from_port="original" to_op="Branch" to_port="input 1"/>
<connect from_op="Branch" from_port="input 1" to_port="result 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
</process>
</operator>
</process>0 -
Hi Marcin,
Thanks for that. I also figured out another way to do it using the "Select Subprocess" Operator. I used some macros to generate the "1" or "2" value required to execute the different processes. I think your solution is probably more robust though.
Cheers,
Rowan0