Options

Set parameter doesn't set parameter in loop

qwertz2qwertz2 Member Posts: 49 Guru
edited September 2019 in Help

 

Dear all,

 

This one is driving me mad... Basically, I took the tutorial of the set parameters operator and put a loop around it.

 

Result 1) Run the process and restart after each time the breakpoint has been reached. The log shows that parameters "C" and "degree" are not always the same.

 

Result 2) Now remove the breakpoint and run the process again. The log shows only a single value for "C" and "degree". Though the optimizer has delivered the correct values, the set parameters operator does not apply them without the breakpoint. Any ideas?!?

 

Best regards

Sachs

 

<?xml version="1.0" encoding="UTF-8"?><process version="7.5.001">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="6.0.002" expanded="true" name="Root">
<process expanded="true">
<operator activated="true" class="retrieve" compatibility="7.5.001" expanded="true" height="68" name="Polynomial" width="90" x="45" y="30">
<parameter key="repository_entry" value="//Samples/data/Polynomial"/>
</operator>
<operator activated="true" class="select_attributes" compatibility="7.5.001" expanded="true" height="82" name="Select Attributes" width="90" x="179" y="34">
<parameter key="attribute_filter_type" value="single"/>
<parameter key="attribute" value="label"/>
<parameter key="invert_selection" value="true"/>
<parameter key="include_special_attributes" value="true"/>
</operator>
<operator activated="true" class="concurrency:loop_attributes" compatibility="7.5.001" expanded="true" height="103" name="Loop Attributes" width="90" x="313" y="34">
<process expanded="true">
<operator activated="true" class="set_role" compatibility="7.5.001" expanded="true" height="82" name="Set Role" width="90" x="45" y="136">
<parameter key="attribute_name" value="%{loop_attribute}"/>
<parameter key="target_role" value="label"/>
<list key="set_additional_roles"/>
</operator>
<operator activated="true" class="multiply" compatibility="7.5.001" expanded="true" height="103" name="Multiply" width="90" x="179" y="136"/>
<operator activated="true" breakpoints="after" class="optimize_parameters_grid" compatibility="6.0.003" expanded="true" height="103" name="Optimize Parameters (Grid)" width="90" x="313" y="34">
<list key="parameters">
<parameter key="Learner.C" value="50,100,150,200,250"/>
<parameter key="Learner.degree" value="1,2,3,4,5"/>
</list>
<process expanded="true">
<operator activated="true" class="concurrency:cross_validation" compatibility="7.5.001" expanded="true" height="145" name="Cross Validation" width="90" x="313" y="34">
<parameter key="number_of_folds" value="3"/>
<parameter key="sampling_type" value="shuffled sampling"/>
<process expanded="true">
<operator activated="true" class="support_vector_machine_libsvm" compatibility="7.5.001" expanded="true" height="82" name="Learner" width="90" x="45" y="34">
<parameter key="svm_type" value="epsilon-SVR"/>
<parameter key="kernel_type" value="poly"/>
<parameter key="degree" value="5"/>
<parameter key="C" value="250"/>
<parameter key="epsilon" value="0.01"/>
<list key="class_weights"/>
</operator>
<connect from_port="training set" to_op="Learner" to_port="training set"/>
<connect from_op="Learner" from_port="model" to_port="model"/>
<portSpacing port="source_training set" spacing="0"/>
<portSpacing port="sink_model" spacing="0"/>
<portSpacing port="sink_through 1" spacing="0"/>
</process>
<process expanded="true">
<operator activated="true" class="apply_model" compatibility="7.1.001" expanded="true" height="82" name="Apply Model" width="90" x="45" y="34">
<list key="application_parameters"/>
</operator>
<operator activated="true" class="performance" compatibility="7.5.001" expanded="true" height="82" name="Performance" width="90" x="179" y="34"/>
<connect from_port="model" to_op="Apply Model" to_port="model"/>
<connect from_port="test set" to_op="Apply Model" to_port="unlabelled data"/>
<connect from_op="Apply Model" from_port="labelled data" to_op="Performance" to_port="labelled data"/>
<connect from_op="Performance" from_port="performance" to_port="performance 1"/>
<portSpacing port="source_model" spacing="0"/>
<portSpacing port="source_test set" spacing="0"/>
<portSpacing port="source_through 1" spacing="0"/>
<portSpacing port="sink_test set results" spacing="0"/>
<portSpacing port="sink_performance 1" spacing="0"/>
<portSpacing port="sink_performance 2" spacing="0"/>
</process>
</operator>
<connect from_port="input 1" to_op="Cross Validation" to_port="example set"/>
<connect from_op="Cross Validation" from_port="performance 1" to_port="performance"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="source_input 2" spacing="0"/>
<portSpacing port="sink_performance" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
</process>
</operator>
<operator activated="true" class="set_parameters" compatibility="7.5.001" expanded="true" height="82" name="Set Parameters" width="90" x="447" y="34">
<list key="name_map">
<parameter key="Learner" value="OptimalLearner"/>
</list>
</operator>
<operator activated="true" class="support_vector_machine_libsvm" compatibility="7.5.001" expanded="true" height="82" name="OptimalLearner" width="90" x="581" y="187">
<parameter key="svm_type" value="epsilon-SVR"/>
<parameter key="kernel_type" value="poly"/>
<parameter key="degree" value="1"/>
<parameter key="C" value="100"/>
<list key="class_weights"/>
</operator>
<operator activated="true" class="log" compatibility="7.5.001" expanded="true" height="82" name="Log" width="90" x="715" y="187">
<list key="log">
<parameter key="C" value="operator.OptimalLearner.parameter.C"/>
<parameter key="degree" value="operator.OptimalLearner.parameter.degree"/>
</list>
</operator>
<connect from_port="input 1" to_op="Set Role" to_port="example set input"/>
<connect from_op="Set Role" from_port="example set output" to_op="Multiply" to_port="input"/>
<connect from_op="Multiply" from_port="output 1" to_op="Optimize Parameters (Grid)" to_port="input 1"/>
<connect from_op="Multiply" from_port="output 2" to_op="OptimalLearner" to_port="training set"/>
<connect from_op="Optimize Parameters (Grid)" from_port="parameter" to_op="Set Parameters" to_port="parameter set"/>
<connect from_op="Set Parameters" from_port="parameter set" to_port="output 1"/>
<connect from_op="OptimalLearner" from_port="exampleSet" to_op="Log" to_port="through 1"/>
<connect from_op="Log" from_port="through 1" to_port="output 2"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="source_input 2" spacing="0"/>
<portSpacing port="sink_output 1" spacing="0"/>
<portSpacing port="sink_output 2" spacing="0"/>
<portSpacing port="sink_output 3" spacing="0"/>
</process>
</operator>
<connect from_op="Polynomial" from_port="output" to_op="Select Attributes" to_port="example set input"/>
<connect from_op="Select Attributes" from_port="example set output" to_op="Loop Attributes" to_port="input 1"/>
<connect from_op="Loop Attributes" from_port="output 1" to_port="result 1"/>
<connect from_op="Loop Attributes" from_port="output 2" to_port="result 2"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
<portSpacing port="sink_result 3" spacing="0"/>
</process>
</operator>
</process>

Best Answer

  • Options
    AndrewAndrew RapidMiner Certified Expert, RapidMiner Certified Master, Member Posts: 47 Guru
    Solution Accepted

    Hello

     

    It's probably because the Loop operator is processing in parallel so the order is indeterminate. Check the "reuse results" parameter to see if that makes a difference.

     

    Andrew

Answers

  • Options
    qwertz2qwertz2 Member Posts: 49 Guru

     

    Thumbs up! That was it! Though I am familiar with this function I didn't take it into account at all. In my setting I cannot reuse the results but the disabling of parallel execution lead to success as well!

     

    Cheers

    Sachs

Sign In or Register to comment.