Beware Generate Macro's result truncation!

tennenrishintennenrishin Member Posts: 177 Contributor II
edited November 2018 in Help
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">
  <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"/>
      <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 key="set_additional_roles"/>
      <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"/>
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.
Sign In or Register to comment.