Beware Generate Macro's result truncation!

tennenrishin
tennenrishin New Altair Community Member
edited November 5 in Altair RapidMiner
To whom it may interest

In the following process's output, why is a != b ?
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.008">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="5.3.008" expanded="true" name="Process">
    <process expanded="true">
      <operator activated="true" class="generate_macro" compatibility="5.3.008" expanded="true" height="60" name="Generate Macro" width="90" x="45" y="30">
        <list key="function_descriptions">
          <parameter key="eps" value="1e-6"/>
        </list>
      </operator>
      <operator activated="true" class="generate_data_user_specification" compatibility="5.3.008" expanded="true" height="60" name="Generate Data by User Specification" width="90" x="246" y="30">
        <list key="attribute_values">
          <parameter key="a" value="1e6*1e-6"/>
          <parameter key="b" value="1e6*%{eps}"/>
        </list>
        <list key="set_additional_roles"/>
      </operator>
      <connect from_op="Generate Data by User Specification" from_port="output" 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>
Because when Generate Macro converts numeric results to strings (as it must) it truncates them according to rapidminer.general.fractiondigits.numbers. You either have to use Set Macro, or change your preferences. Simply quoting doesn't work either, because Generate Macros, unlike Generate Attributes, tries to convert string->number->string.
Tagged: