[SOLVED] problem at numerical to polynominal operator: decimals loss

CharlieFirpoCharlieFirpo Member Posts: 48 Contributor II
edited November 2018 in Help
Dear All,

I have a real attribute with this value: 0.0000123
I want a macro to hold this value (with Extract Macro operator). The macro value is: 0.000
When I convert the real attribute to string (with Numerical to Polynominal operator), the attribute value will be 0.000
If I use the 'str()' function at Generate Attributes operator, the value will be 0.000
Why? Why? Why... Why does the 'real to string' function truncate the decimals?

At Tools menu in General tab I have 3 at rapidminer.general.fractiondigits.number. I can change it to eg. 10 but I can do this only on my local RapidMiner. What is the workaround when creating a process for a remote machine / other RM? Can I set this option via my RapidMiner process? Or can I solve this problem otherwise?

My task can be eg. to count the decimals. Eg. at 0.0000123 value, the decimals number is 7.

Thank you!

Answers

  • JEdwardJEdward RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 564   Unicorn
    How about one of these options? 
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.3.015">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.3.015" expanded="true" name="Process">
        <process expanded="true">
          <operator activated="true" class="generate_data_user_specification" compatibility="5.3.015" expanded="true" height="60" name="Generate Data by User Specification" width="90" x="45" y="30">
            <list key="attribute_values">
              <parameter key="Real" value="0.0000123"/>
              <parameter key="Nominal" value="&quot;0.0000123&quot;"/>
            </list>
            <list key="set_additional_roles"/>
          </operator>
          <operator activated="true" class="generate_attributes" compatibility="5.3.015" expanded="true" height="76" name="Generate Attributes" width="90" x="179" y="30">
            <list key="function_descriptions">
              <parameter key="RealtoString" value="str(Real)"/>
              <parameter key="RealMultiplied" value="Real*10000"/>
              <parameter key="RealWithFormat" value="Real"/>
            </list>
          </operator>
          <operator activated="true" class="format_numbers" compatibility="5.3.015" expanded="true" height="76" name="Format Numbers" width="90" x="380" y="30">
            <parameter key="attribute_filter_type" value="single"/>
            <parameter key="attribute" value="RealWithFormat"/>
            <parameter key="format_type" value="pattern"/>
            <parameter key="pattern" value="#.###############"/>
          </operator>
          <connect from_op="Generate Data by User Specification" from_port="output" to_op="Generate Attributes" to_port="example set input"/>
          <connect from_op="Generate Attributes" from_port="example set output" to_op="Format Numbers" to_port="example set input"/>
          <connect from_op="Format Numbers" from_port="example set 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>
  • CharlieFirpoCharlieFirpo Member Posts: 48 Contributor II
    Thank you!
    It works perfectly!!!!!!!!!
Sign In or Register to comment.