Options

"[Solved] Use of macro within loop parameter deletes all attributes"

qwertzqwertz Member Posts: 130 Contributor II
edited June 2019 in Help
Dear all,

I discovered that it is not possible to use "generate macro" within in the "loop parameter" operator. In that case the process shows no output at all.

Please see also my post "Missing output of Loop Parameters operator" regarding a strange outcome with this parameter.
http://rapid-i.com/rapidforum/index.php/topic,5288.0.html

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.2.003">
 <context>
   <input/>
   <output/>
   <macros/>
 </context>
 <operator activated="true" class="process" compatibility="5.2.003" expanded="true" name="Process">
   <process expanded="true" height="410" width="279">
     <operator activated="true" class="generate_data" compatibility="5.2.003" expanded="true" height="60" name="Generate Data" width="90" x="45" y="30"/>
     <operator activated="true" class="loop_parameters" compatibility="5.2.003" expanded="true" height="76" name="Loop Parameters" width="90" x="179" y="30">
       <list key="parameters">
         <parameter key="Windowing.label_attribute" value="att1,att2"/>
       </list>
       <process expanded="true" height="428" width="652">
         <operator activated="true" class="series:windowing" compatibility="5.1.002" expanded="true" height="76" name="Windowing" width="90" x="45" y="30">
           <parameter key="create_label" value="true"/>
           <parameter key="label_attribute" value="att2"/>
         </operator>
         <operator activated="true" class="generate_macro" compatibility="5.2.003" expanded="true" height="76" name="Generate Macro" width="90" x="246" y="30">
           <list key="function_descriptions">
             <parameter key="mymacro" value="param(&quot;Windowing&quot;, &quot;label_attribute&quot;)"/>
           </list>
         </operator>
         <connect from_port="input 1" to_op="Windowing" to_port="example set input"/>
         <connect from_op="Windowing" from_port="example set output" to_op="Generate Macro" to_port="through 1"/>
         <connect from_op="Generate Macro" from_port="through 1" to_port="result 1"/>
         <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"/>
         <portSpacing port="sink_result 2" spacing="0"/>
       </process>
     </operator>
     <connect from_op="Generate Data" from_port="output" to_op="Loop Parameters" to_port="input 1"/>
     <connect from_op="Loop Parameters" from_port="result 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>

Best regards
Sachs

Answers

  • Options
    MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    Hi Sachs,

    if you have a look at the process log, you will see the following message:
    Jul 23, 2012 4:52:41 PM SEVERE: Loop Parameters: Cannot evaluate performance for current parameter combination because of an error in one of the inner operators: Generation exception: 'Unrecognized symbol "param"
    Encountered "," at line 1, column 18.
    Was expecting one of:
        ">" ...
        "<" ...
        "==" ...
        "<=" ...
        ">=" ...
        "!=" ...
        "&&" ...
        "||" ...
        "+" ...
        "-" ...
        "^" ...
        ")" ...
        <STRING_LITERAL> ...
        <INTEGER_LITERAL> ...
        <FLOATING_POINT_LITERAL> ...
        <INDENTIFIER1> ...
        <INDENTIFIER2> ...
        "(" ...
        "[" ...
        "*" ...
        "." ...
        "^^" ...
        "/" ...
        "%" ...
       
    '
    That, means, that the Generate Macro operator had an error, and the loop iterations did not complete.
    The reason is that you currently can't use the param() function in Generate Macro.

    Best, Marius
  • Options
    qwertzqwertz Member Posts: 130 Contributor II


    Ahh... the log... after seeing the solution I am always wondering why I haven't seen it before...

    Thanks!
  • Options
    MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    Well, I have to admit that the behaviour is not very intuitive, because usually the process stops if you have an error.. it's like this loop operator has an  integrated Handle Exception. We didn't change it until now to keep compatibility with older versions.

    Best,
      ~Marius
Sign In or Register to comment.